SOAP Question

B

Brian P

I am working on a new program that uses a SOAP interface. I have written
a few of these before, but this time it is giving me trouble. I suspect
there is a problem with on the SOAP handler side, but since I'm not an expect
I cannot be sure.

The vendor has provided me a url to the WSDL document for the soap service.
Using the .Net WSDL utility, I generate a c# proxy class. When I'm trying
to use the methods of the soap service, I get an error saying the method
could not be executed.

What I find strange is, looking at my generated soap proxy class, the URL
points back to the WSDL URL, not a URL to a asmx or other page. Does this
make sense. How can a WSDL document handle soap requests?

I asked the vendor and they said that it is correct...

Thanks for any help...
Brian
 
N

Nicholas Paldino [.NET/C# MVP]

Brian,

It is correct. When you invoke the method, the url that is called is
reconstructed from that base URL (with the WSDL) and then a request is sent
to that.

You might want to consider running a trace, to see what output you are
generating, and send it to the vendor exposing the web service (if you think
it is correct).

Hope this helps.
 
B

Brian P

I guess I just don't understand why it doesn't work. This is how I've done
web services before and never had any problems.

When you say run a trace, I'm not clear what that means. It is a very simple
web service, I'm passing a username and password and I get back a token string.
I've stepped through the code up until the point it goes into the System.Web.Services
assembly and the exception is being generated inside there, so I don't know
how I can look to see what is going on.

Thanks,
Brian
 
N

Nicholas Paldino [.NET/C# MVP]

Brian,

What I mean by a trace is to look at the XML that is output and sent to
the web service.

What is the exception that is being thrown, btw?
 
B

Brian P

This is the exception:

System.Web.Services.Protocols.SoapException: WSDLOperation: Executing method
Logon failed
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at LogonService.Logon(String ServiceName, String UserName, String Password)
in C:\dev\Sandbox.CDMS\Sandbox.CDMS.Core\LogonService.cs:line 38
at Sandbox.CDMS.Core.Program.Main(String[] args) in c:\dev\sandbox.cdms\sandbox.cdms.core\program.cs:line
18


I'm not sure how to look at the XML generated. In the LogonService class
(which was generated by wsdl.exe), the method Logon calls into the parent
class SoapHttpClientProtocal's Invoke method. From there, to me it's a black
hole. I'm sure there are ways of looking at the XML but I'm not sure how.


I'm not sure if code is revelant, its a fairly simple test class. I suspect
any issues would have to be in the LogonService code, or the web service
itself. Is this at least true? And since the LogonService code is generated
by thw wsdl.exe utility using the web service's wsdl document, then, doesn't
this also make sense that something is wrong with the web service?

string token = null;
LogonService logon = new LogonService;
try
{
token = logon.Logon("UserName", "Password");
}
catch (SoapException ex)
{
Console.Writeline(ex.ToString());
}


Thanks for looking at this...
Brian
 
N

Nicholas Paldino [.NET/C# MVP]

Brian,

You will want to look at the XML going over the wire, and the XML
returning from the website.

There is a tool called Fiddler that you can use which is free which will
trace TCP/IP traffic (you will have to change your client around a little,
but not substantially, just the URL of the site). You can use this to view
the XML going out and coming back.


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

Brian P said:
This is the exception:

System.Web.Services.Protocols.SoapException: WSDLOperation: Executing
method Logon failed
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at LogonService.Logon(String ServiceName, String UserName, String
Password) in C:\dev\Sandbox.CDMS\Sandbox.CDMS.Core\LogonService.cs:line 38
at Sandbox.CDMS.Core.Program.Main(String[] args) in
c:\dev\sandbox.cdms\sandbox.cdms.core\program.cs:line 18


I'm not sure how to look at the XML generated. In the LogonService class
(which was generated by wsdl.exe), the method Logon calls into the parent
class SoapHttpClientProtocal's Invoke method. From there, to me it's a
black hole. I'm sure there are ways of looking at the XML but I'm not
sure how.


I'm not sure if code is revelant, its a fairly simple test class. I
suspect any issues would have to be in the LogonService code, or the web
service itself. Is this at least true? And since the LogonService code
is generated by thw wsdl.exe utility using the web service's wsdl
document, then, doesn't this also make sense that something is wrong with
the web service?

string token = null;
LogonService logon = new LogonService;
try
{
token = logon.Logon("UserName", "Password");
}
catch (SoapException ex)
{
Console.Writeline(ex.ToString());
}


Thanks for looking at this...
Brian

Brian,

What I mean by a trace is to look at the XML that is output and
sent to the web service.

What is the exception that is being thrown, btw?
 
B

Brian P

I used fiddler to examine the xml and here is something of interest:

SOAPAction: "http://tempuri.org/action/LogonManager.Logon"

This has to be the problem. So, I'm back to thinking something is wrong
with the web server / WSDSL document.


Thanks for your help. I suspected there was an issue, but I couldn't pin
it down. (At least, I'm assuming this is the problem, maybe you can confirm.)

--Brian

Brian,

You will want to look at the XML going over the wire, and the XML
returning from the website.

There is a tool called Fiddler that you can use which is free
which will trace TCP/IP traffic (you will have to change your client
around a little, but not substantially, just the URL of the site).
You can use this to view the XML going out and coming back.

This is the exception:

System.Web.Services.Protocols.SoapException: WSDLOperation: Executing
method Logon failed
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(Soa
pClientMessage
message, WebResponse response, Stream responseStream, Boolean
asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at LogonService.Logon(String ServiceName, String UserName, String
Password) in
C:\dev\Sandbox.CDMS\Sandbox.CDMS.Core\LogonService.cs:line 38
at Sandbox.CDMS.Core.Program.Main(String[] args) in
c:\dev\sandbox.cdms\sandbox.cdms.core\program.cs:line 18
I'm not sure how to look at the XML generated. In the LogonService
class (which was generated by wsdl.exe), the method Logon calls into
the parent class SoapHttpClientProtocal's Invoke method. From there,
to me it's a black hole. I'm sure there are ways of looking at the
XML but I'm not sure how.

I'm not sure if code is revelant, its a fairly simple test class. I
suspect any issues would have to be in the LogonService code, or the
web service itself. Is this at least true? And since the
LogonService code is generated by thw wsdl.exe utility using the web
service's wsdl document, then, doesn't this also make sense that
something is wrong with the web service?

string token = null;
LogonService logon = new LogonService;
try
{
token = logon.Logon("UserName", "Password");
}
catch (SoapException ex)
{
Console.Writeline(ex.ToString());
}
Thanks for looking at this...
Brian
Brian,

What I mean by a trace is to look at the XML that is output and sent
to the web service.

What is the exception that is being thrown, btw?

I guess I just don't understand why it doesn't work. This is how
I've done web services before and never had any problems.

When you say run a trace, I'm not clear what that means. It is a
very simple web service, I'm passing a username and password and I
get back a token string. I've stepped through the code up until the
point it goes into the System.Web.Services assembly and the
exception is being generated inside there, so I don't know how I
can look to see what is going on.

Thanks,
Brian
Brian,

It is correct. When you invoke the method, the url that is called
is reconstructed from that base URL (with the WSDL) and then a
request
is sent to that.
You might want to consider running a trace, to see what output you
are generating, and send it to the vendor exposing the web service
(if
you think it is correct).
Hope this helps.
I am working on a new program that uses a SOAP interface. I have
written a few of these before, but this time it is giving me
trouble. I suspect there is a problem with on the SOAP handler
side, but since I'm not an expect I cannot be sure.

The vendor has provided me a url to the WSDL document for the
soap service. Using the .Net WSDL utility, I generate a c# proxy
class. When I'm trying to use the methods of the soap service, I
get an error saying the method could not be executed.

What I find strange is, looking at my generated soap proxy class,
the URL points back to the WSDL URL, not a URL to a asmx or other
page. Does this make sense. How can a WSDL document handle soap
requests?

I asked the vendor and they said that it is correct...

Thanks for any help...
Brian
 
N

Nicholas Paldino [.NET/C# MVP]

Brian,

The soap action being a temp URI could be part of it, but without seeing
the WSDL, it's hard to say.

You should speak with the vendors, and ask them to double check that
their web service works with the WSDL tool, and show them what you have
found.


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

Brian P said:
I used fiddler to examine the xml and here is something of interest:

SOAPAction: "http://tempuri.org/action/LogonManager.Logon"

This has to be the problem. So, I'm back to thinking something is wrong
with the web server / WSDSL document.


Thanks for your help. I suspected there was an issue, but I couldn't pin
it down. (At least, I'm assuming this is the problem, maybe you can
confirm.)

--Brian

Brian,

You will want to look at the XML going over the wire, and the XML
returning from the website.

There is a tool called Fiddler that you can use which is free
which will trace TCP/IP traffic (you will have to change your client
around a little, but not substantially, just the URL of the site).
You can use this to view the XML going out and coming back.

This is the exception:

System.Web.Services.Protocols.SoapException: WSDLOperation: Executing
method Logon failed
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(Soa
pClientMessage
message, WebResponse response, Stream responseStream, Boolean
asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at LogonService.Logon(String ServiceName, String UserName, String
Password) in
C:\dev\Sandbox.CDMS\Sandbox.CDMS.Core\LogonService.cs:line 38
at Sandbox.CDMS.Core.Program.Main(String[] args) in
c:\dev\sandbox.cdms\sandbox.cdms.core\program.cs:line 18
I'm not sure how to look at the XML generated. In the LogonService
class (which was generated by wsdl.exe), the method Logon calls into
the parent class SoapHttpClientProtocal's Invoke method. From there,
to me it's a black hole. I'm sure there are ways of looking at the
XML but I'm not sure how.

I'm not sure if code is revelant, its a fairly simple test class. I
suspect any issues would have to be in the LogonService code, or the
web service itself. Is this at least true? And since the
LogonService code is generated by thw wsdl.exe utility using the web
service's wsdl document, then, doesn't this also make sense that
something is wrong with the web service?

string token = null;
LogonService logon = new LogonService;
try
{
token = logon.Logon("UserName", "Password");
}
catch (SoapException ex)
{
Console.Writeline(ex.ToString());
}
Thanks for looking at this...
Brian
Brian,

What I mean by a trace is to look at the XML that is output and sent
to the web service.

What is the exception that is being thrown, btw?

I guess I just don't understand why it doesn't work. This is how
I've done web services before and never had any problems.

When you say run a trace, I'm not clear what that means. It is a
very simple web service, I'm passing a username and password and I
get back a token string. I've stepped through the code up until the
point it goes into the System.Web.Services assembly and the
exception is being generated inside there, so I don't know how I
can look to see what is going on.

Thanks,
Brian
Brian,

It is correct. When you invoke the method, the url that is called
is reconstructed from that base URL (with the WSDL) and then a
request
is sent to that.
You might want to consider running a trace, to see what output you
are generating, and send it to the vendor exposing the web service
(if
you think it is correct).
Hope this helps.
I am working on a new program that uses a SOAP interface. I have
written a few of these before, but this time it is giving me
trouble. I suspect there is a problem with on the SOAP handler
side, but since I'm not an expect I cannot be sure.

The vendor has provided me a url to the WSDL document for the
soap service. Using the .Net WSDL utility, I generate a c# proxy
class. When I'm trying to use the methods of the soap service, I
get an error saying the method could not be executed.

What I find strange is, looking at my generated soap proxy class,
the URL points back to the WSDL URL, not a URL to a asmx or other
page. Does this make sense. How can a WSDL document handle soap
requests?

I asked the vendor and they said that it is correct...

Thanks for any help...
Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top