Last post Oct 01, 2008 07:16 PM by johnwsaunders3
Oct 01, 2008 03:30 PM|salex2|LINK
Hey there - I'm stuck, and need a bit of help from you gurus - again.
I have to work with a remote (third party) java web service that is "document style" versus the common "RPC style". I need to pass an XML document - as a string object - to the web service as well as a SOAP header that contains the username and password.
However, I cannot figure out how to get things to work.
When I create an instance of the web service and try to use the various methods (there are only three), none of them appear to accept NOR require any kind of authentication, soap header, etc.
Example of what I see with intellisense...
ws.MyRemoteWebMethod(object as Object)
...and that's it. No other input, or output. No indication of where to include a SoapHeader for authentication, etc.
Is there a special way to add the authentication in a SOAP header to the "object" so it is passed properly?
NOTE: There is minimal documentation on this web service from a .NET perspective, though they tell me it should be 100% compatible. In fact, we are the first .NET client they've ever had... all the rest have been Java.
Here's my code (if it helps):
xOutput = ws.submitData(xDoc.OuterXml)
I did try to pass credentials like this (but didn't work):
Any help you guys can offer is MUCH appreciated.
Oct 01, 2008 07:16 PM|johnwsaunders3|LINK
Don't tell me - let me guess. The username and password header is not described by the WSDL, right? It's a Java Axis web service.
I have heard this many times before, and the answer is always the same: the WSDL
must be the contract between the client and the service. The service can't require the client to send anything that is not specified in the WSDL. If the web service owners do not describe these headers in the WSDL, then they'll have to describe
them to you some other way. Like by email.
You will not be able to use the built-in facilities of .NET to send these headers. Those facilities assume that the service follows International standards and is self-describing. You will have to write a SOAP Extension to send the headers, since the client
will not be able to do so.
If the headers were described in the WSDL, then the proxy code generated when you used "Add Web Reference" would have included a property on the proxy class that you could set to an instance of the header. That's all you'd have to do.
Note that there are several other instances where Axis assumes that the client "just knows" something. For instance, Axis will generate a schema that refers to the type axis:Element, yet that type is not defined anywhere. I guess any Axis system "just knows"
what that type is.
Good luck. I recommend you put the pressure back on the Java people to explain how this adheres to standards. If you like, you can refer them to me.