Urgent: Webservice method not recognizing parameters

  • Thread starter Thread starter Razzie
  • Start date Start date
R

Razzie

Hey all,

I have a SOAP envelope with which I try to communicate to a webservice.
Everything is fine, but when I try to access a parameter of the webservice
method, I get the Object reference not set to an instance of the object
error.

This is the method:

public string query(string type, string[] someValues)
{
// As soon as I try to access a parameter, eg. type.Length or
someValues.Length, I get the error
}

The soap body looks like this:

msg = msg & "<soap:Body>"
msg = msg & "<query xmlns='xxxxxx'>"
msg = msg & "<type>type1</type>"
msg = msg & "<someValues>"
msg = msg & "<string>value1</string>"
msg = msg & "<string>value2</string>"
msg = msg & "<string>value3</string>"
msg = msg & "<string>value4</string>"
msg = msg & "</someValues>"
msg = msg & "</query>"
msg = msg & "</soap:Body>"
 
Razzie,

I am curious, are you on the receiving end of this call? If so, then
why are you not using ASP.NET to expose the web service? This way, you
don't have to worry about the plumbing in between your method and it being
exposed to the outside world.
 
Hey Nicholas,

I'm not quite sure if I understand what you mean.
The webservice will be made public eventually for customers of the company.
We want to support SOAP as a way of communicating with it for them. So
that's why I am testing a soap script with it. Or is that not what you mean?

Thanks,

Razzie

Nicholas Paldino said:
Razzie,

I am curious, are you on the receiving end of this call? If so, then
why are you not using ASP.NET to expose the web service? This way, you
don't have to worry about the plumbing in between your method and it being
exposed to the outside world.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Razzie said:
Hey all,

I have a SOAP envelope with which I try to communicate to a webservice.
Everything is fine, but when I try to access a parameter of the webservice
method, I get the Object reference not set to an instance of the object
error.

This is the method:

public string query(string type, string[] someValues)
{
// As soon as I try to access a parameter, eg. type.Length or
someValues.Length, I get the error
}

The soap body looks like this:

msg = msg & "<soap:Body>"
msg = msg & "<query xmlns='xxxxxx'>"
msg = msg & "<type>type1</type>"
msg = msg & "<someValues>"
msg = msg & "<string>value1</string>"
msg = msg & "<string>value2</string>"
msg = msg & "<string>value3</string>"
msg = msg & "<string>value4</string>"
msg = msg & "</someValues>"
msg = msg & "</query>"
msg = msg & "</soap:Body>"

-----------------------

So what exactly am I missing here? I've used this before and it worked fine.
So I'm completely in the dark as to why I get this error. I hope someone can
help me with this. Thanks :)
 
Razzie,

Instead of writing your own request for the web service, why not just
create a test project and set a reference to the web service? This way, you
can test the web serivce, and not have to write all that plumbing code
yourself.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Razzie said:
Hey Nicholas,

I'm not quite sure if I understand what you mean.
The webservice will be made public eventually for customers of the company.
We want to support SOAP as a way of communicating with it for them. So
that's why I am testing a soap script with it. Or is that not what you mean?

Thanks,

Razzie

message news:[email protected]...
Razzie,

I am curious, are you on the receiving end of this call? If so, then
why are you not using ASP.NET to expose the web service? This way, you
don't have to worry about the plumbing in between your method and it being
exposed to the outside world.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Razzie said:
Hey all,

I have a SOAP envelope with which I try to communicate to a webservice.
Everything is fine, but when I try to access a parameter of the webservice
method, I get the Object reference not set to an instance of the object
error.

This is the method:

public string query(string type, string[] someValues)
{
// As soon as I try to access a parameter, eg. type.Length or
someValues.Length, I get the error
}

The soap body looks like this:

msg = msg & "<soap:Body>"
msg = msg & "<query xmlns='xxxxxx'>"
msg = msg & "<type>type1</type>"
msg = msg & "<someValues>"
msg = msg & "<string>value1</string>"
msg = msg & "<string>value2</string>"
msg = msg & "<string>value3</string>"
msg = msg & "<string>value4</string>"
msg = msg & "</someValues>"
msg = msg & "</query>"
msg = msg & "</soap:Body>"
someone
can
help me with this. Thanks :)
 
Ah yes. I did that too - that works. It's not the webservice what I'm think
is not working, but there is something wrong with the SOAP envelope. I just
can't figure out what it is though. If anyone still has a suggestion, I'd
appreciate it.

Thanks.

Nicholas Paldino said:
Razzie,

Instead of writing your own request for the web service, why not just
create a test project and set a reference to the web service? This way, you
can test the web serivce, and not have to write all that plumbing code
yourself.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Razzie said:
Hey Nicholas,

I'm not quite sure if I understand what you mean.
The webservice will be made public eventually for customers of the company.
We want to support SOAP as a way of communicating with it for them. So
that's why I am testing a soap script with it. Or is that not what you mean?

Thanks,

Razzie

message news:[email protected]...
Razzie,

I am curious, are you on the receiving end of this call? If so, then
why are you not using ASP.NET to expose the web service? This way, you
don't have to worry about the plumbing in between your method and it being
exposed to the outside world.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hey all,

I have a SOAP envelope with which I try to communicate to a webservice.
Everything is fine, but when I try to access a parameter of the webservice
method, I get the Object reference not set to an instance of the object
error.

This is the method:

public string query(string type, string[] someValues)
{
// As soon as I try to access a parameter, eg. type.Length or
someValues.Length, I get the error
}

The soap body looks like this:

msg = msg & "<soap:Body>"
msg = msg & "<query xmlns='xxxxxx'>"
msg = msg & "<type>type1</type>"
msg = msg & "<someValues>"
msg = msg & "<string>value1</string>"
msg = msg & "<string>value2</string>"
msg = msg & "<string>value3</string>"
msg = msg & "<string>value4</string>"
msg = msg & "</someValues>"
msg = msg & "</query>"
msg = msg & "</soap:Body>"

-----------------------

So what exactly am I missing here? I've used this before and it worked
fine.
So I'm completely in the dark as to why I get this error. I hope someone
can
help me with this. Thanks :)
 
Back
Top