.NET Forum / ASP.NET / Web Services / September 2005
How to resolve SOAP differences
|
|
Thread rating:  |
MR - 23 Aug 2005 20:27 GMT my soap messages to a remote site are failing. as far as i can tell the only differences between what my SOAP message looks liek and what they want are in the SOAP envelope SInce they don't have a wsdl doc i created a localhost site based on their DTD documetns.
How do I configure my site (and client proxy) to match thier envelope?
Any help would be greatly appreciated thanks mr
WHAT THEY WANT
<?xml version="1.0" encoding="UTF-8" ?> - <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> - <SOAP-ENV:Body> - <ns1:submitOrderBatch xmlns:ns1="urn:OrderOperations" SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
WHAT I AM SENDING <?xml version="1.0" encoding="utf-8" ?> - <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <soap:Body> - <orderBatchElement xmlns="http://tempuri.org/"> - <submitOrderBatch CustomerBatchID="58" xmlns="http://tempuri.org/submitOrderBatch.xs">
[MSFT] - 24 Aug 2005 04:08 GMT Hello,
Maybe you can try Soap Toolkit 3.0, it will send the soap message like:
SOAP-ENV:Envelope
Here is the link for download it:
http://www.microsoft.com/downloads/details.aspx?FamilyId=C943C0DD-CEEC-4088- 9753-86F052EC8450&displaylang=en
Luke
MR - 24 Aug 2005 10:06 GMT i am looking there but so far it is not that helpful in that it assumes that i have a valid wsdl file.
what i need to know is how to use the formatting using SOAP-ENV: tags instead of soap: i am building a localhost version of the website so that i can test and create the wsdl doc. so i need to know if there are any attributes that i can use on my test site that will create the wsdl that will be used to create the proxy to sent soap messages formatted in this way. thanks m
> Hello, > [quoted text clipped - 8 lines] > > Luke Stefan Misch - 24 Aug 2005 13:04 GMT Are you sure that it's the "soap" instead of the "SOAP-ENV" that causes the problem? After all these are just local namespace prefixes for "http://schemas.xmlsoap.org/soap/envelope/". As long as this URI is the same for the prefixes defined it should make no difference.
I expect the problem could be the "submitOrderBatch" node. As "they" define a NS with xmlns:ns1="urn:OrderOperations" but you define xmlns="http://tempuri.org/", which is another NS. So "your" node sumbitOrderBatch is not the submitOrderBatch they expect.
Just a thought... Stefan
> my soap messages to a remote site are failing. as far as i can tell the > only differences between what my SOAP message looks liek and what they [quoted text clipped - 28 lines] > - <submitOrderBatch CustomerBatchID="58" > xmlns="http://tempuri.org/submitOrderBatch.xs"> MR - 24 Aug 2005 14:29 GMT you are probably right! i got rid of the http://tempuri.or, but how do i set the xmlns:ns1 in my webmethod? some attribute? i really appreciate your help on this. i have spent a lot of time and have gotten nowhere again thanks m
> Are you sure that it's the "soap" instead of the "SOAP-ENV" that causes > the problem? After all these are just local namespace prefixes for [quoted text clipped - 41 lines] >> - <submitOrderBatch CustomerBatchID="58" >> xmlns="http://tempuri.org/submitOrderBatch.xs"> Stefan Misch - 24 Aug 2005 15:13 GMT How do you construct your SOAP request and how do you send it? Have you tried to use no NS at all? It could work, if the submitOrderBatch nodes does not define any NS at all, but that depends on the WS server. Some WS servers are a bit strict on the formal format of the SOAP message.
I also don't understand why you have no WSDL. Normaly this is where VS gets the information about the web service methods, types and namespaces. Did you try to use the WS-address and append "?WSDL". Some WS then offer the WSDL. Just try with your web browser and see what happens.
> you are probably right! > i got rid of the http://tempuri.or, but how do i set the xmlns:ns1 in my [quoted text clipped - 49 lines] >>> - <submitOrderBatch CustomerBatchID="58" >>> xmlns="http://tempuri.org/submitOrderBatch.xs"> MR - 24 Aug 2005 20:45 GMT someone mentioned to me that the explanation is that the .NET default is rpc/encoded while that of apache servers is document/literal (or visa versa). what attribute do i use when i define my web methods to specify which format i want.
> How do you construct your SOAP request and how do you send it? Have you > tried to use no NS at all? It could work, if the submitOrderBatch nodes [quoted text clipped - 59 lines] >>>> - <submitOrderBatch CustomerBatchID="58" >>>> xmlns="http://tempuri.org/submitOrderBatch.xs"> Stefan Misch - 25 Aug 2005 13:32 GMT The WS I'm talking to is hosted on an IBM Web application server and the web server is an Apache server. So I guess my configuration is comparable to yours.
Again, I don't understand why you have no WSDL. I can access my WSDL using IE and entering the web service's URL plus appending "?WSDL" at the end, something like "http://www.somedomain.xxx/Services/SomeService?WSDL". Please try that before you do anything else.
I added this WSDL-URL as a web reference to a sample VS C# console application. VS generated everything I need to call the web service. Calling the WS was as easy as:
// initialize parameters wsParameter.param1 = SomeValue1; ... wsParameter.paramX = SomeValueX; // call web service wsResult = wsSomeService.SomeMethod(wsParameter);
The classes for wsParameter, wsResult and wsSomeService where generated by VS based on the WSDL.
BTW, looking into the generated classes I can see that the web method I'm calling is RPC/encoded: [System.Web.Services.Protocols.SoapRpcMethodAttribute("SomeMethod", RequestNamespace="SomeURI", ResponseNamespace="SomeURI")]
> someone mentioned to me that the explanation is that the .NET default is > rpc/encoded while that of apache servers is document/literal (or visa [quoted text clipped - 65 lines] >>>>> - <submitOrderBatch CustomerBatchID="58" >>>>> xmlns="http://tempuri.org/submitOrderBatch.xs"> MR - 25 Aug 2005 15:24 GMT first i really appreciate your help, you cannot imagind how much time i have spent on this already.
second, when i try to get the wsdl doc, i get the following error: SOAP RPC Router Sorry, I don't speak via HTTP GET- you have to use HTTP POST to talk to me. also i have asked them many times and they keep insisting that they don't have one
third, the code you sent me was an improvement, i had gotten that far already. but what attributes do you have on the class? i have [WebService(Description = "Web Services Interoperability Test",Namespace = "urn:UserOperations")][SoapRpcService(RoutingStyle=SoapServiceRoutingStyle.SoapAction)] but it doens't work again thanks for your help so far
> The WS I'm talking to is hosted on an IBM Web application server and the > web server is an Apache server. So I guess my configuration is comparable [quoted text clipped - 95 lines] >>>>>> - <submitOrderBatch CustomerBatchID="58" >>>>>> xmlns="http://tempuri.org/submitOrderBatch.xs"> Stefan Misch - 25 Aug 2005 17:13 GMT Mhh.. I don't know if this will help you, as my code is generated code from the WSDL and I don't know where it could fit in your code, but here I go:
[System.Web.Services.WebServiceBindingAttribute(Name="SomeNameSoapBinding", Namespace="SomeNS")] public class KMURatingWsService : System.Web.Services.Protocols.SoapHttpClientProtocol { ... [System.Web.Services.Protocols.SoapRpcMethodAttribute("SomeMethod", RequestNamespace="SomeNS", ResponseNamespace="SomeNS")] [return: System.Xml.Serialization.SoapElementAttribute("SomeMethodReturn")] public ResultType SomeMethod(ParamType1 param1, ParamType2 param2) { ... } ... classes for ParamType1, ParamType2 and ResultType like [System.Xml.Serialization.SoapTypeAttribute("Param1Type", "SomeURL")] public class Param1Type { ... just a sequence of int's and string's } } Again, I doubt that this will help you very much, as the WSDL defines the binding protcoll needed for accessing the WS. So the binding is something that is defined in the WSDL. If you don't have a WSDL what would the binding be good for?
Wouldn't it be better for you to construct your own XML, so that it matches the XML SOAP envelope required by "their" web service and post the request "by hand" using HttpWebRequest/HttpWebResponse. See http://msdn.microsoft.com/msdnmag/issues/01/09/cweb/ as a first start.
> first i really appreciate your help, you cannot imagind how much time i > have spent on this already. [quoted text clipped - 114 lines] >>>>>>> - <submitOrderBatch CustomerBatchID="58" >>>>>>> xmlns="http://tempuri.org/submitOrderBatch.xs"> MR - 28 Aug 2005 06:43 GMT thanks for your help. i am hand coding it now. what tool can i use to trace the messages? the remote site uses https so i can't use a regular sniffer. i tried using winhttpcfg, but i don't see any data, it seems that it just logs the start of a session, but no data within the session thanks m
> Mhh.. I don't know if this will help you, as my code is generated code > from the WSDL and I don't know where it could fit in your code, but here I [quoted text clipped - 149 lines] >>>>>>>> - <submitOrderBatch CustomerBatchID="58" >>>>>>>> xmlns="http://tempuri.org/submitOrderBatch.xs"> Stefan Misch - 28 Aug 2005 23:22 GMT For tracing may be that http://www.pocketsoap.com/ helps you. There are a number of free trace tools available (YATT (Yet Another Trace Tool), PcapTrace, TcpTrace, ProxyTrace) but I guess they won't be able to trace HTTPS.
WinHttpCfg only traces traffic through the ServerXMLHTTP object which is not used by .NET. But WinHttpCfg is able to trace HTTPS.
If you find any way to trace HTTPS using .NET WebRequest/WebResponse please tell me, as I'm also looking for a way to do this (for others reading this thread: with tracing I mean a reasonable way of representing the data that goes over the wire, I'm not a network guru and don't think that a network sniffer will help my in tracing SOAP messages over HTTPS). A tool like WinHttpCfg for ServerXMLHTTP would be great for .NET's WebRequest/WebResponse, but will do
Stefan
> thanks for your help. i am hand coding it now. > what tool can i use to trace the messages? the remote site uses https so i [quoted text clipped - 157 lines] >>>>>>>>> - <submitOrderBatch CustomerBatchID="58" >>>>>>>>> xmlns="http://tempuri.org/submitOrderBatch.xs"> MR - 30 Aug 2005 07:22 GMT first i'd like to thank you for the enormous amount of help that you have given so far far. i will look into pocketsoap tools. most of the ones i've seen either don't work on https or require a wsdl doc which i don't have however i can tell you that using a sniffer on https will allow you to see the encrypted message which is not very useful since you cannot see any content
> For tracing may be that http://www.pocketsoap.com/ helps you. There are a > number of free trace tools available (YATT (Yet Another Trace Tool), [quoted text clipped - 182 lines] >>>>>>>>>> - <submitOrderBatch CustomerBatchID="58" >>>>>>>>>> xmlns="http://tempuri.org/submitOrderBatch.xs"> MR - 30 Aug 2005 07:37 GMT i am looking at PocketSoap's proxy trace. they have an instruction " Simply configure your SOAP client to use a HTTP proxy server, leave all the addresses as normal, and off you go." how do i configure my client to use an HTTP proxy server? thanks
> For tracing may be that http://www.pocketsoap.com/ helps you. There are a > number of free trace tools available (YATT (Yet Another Trace Tool), [quoted text clipped - 182 lines] >>>>>>>>>> - <submitOrderBatch CustomerBatchID="58" >>>>>>>>>> xmlns="http://tempuri.org/submitOrderBatch.xs"> Stefan Misch - 30 Aug 2005 08:34 GMT If you start proxyTrace you must supply a port number, the default is 8080. So the proxy on your PC is http://localhost:8080. This address must be set to the "Proxy" property of HttpWebRequest. See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr fSystemNetHttpWebRequestClassProxyTopic.asp
So you end up with something like:
... WebProxy traceProxy = new WebProxy(http://localhost:8080); httpRequest.Proxy = traceProxy; ...
>i am looking at PocketSoap's proxy trace. they have an instruction " Simply >configure your SOAP client to use a HTTP proxy server, leave all the [quoted text clipped - 200 lines] >>>>>>>>>>> - <submitOrderBatch CustomerBatchID="58" >>>>>>>>>>> xmlns="http://tempuri.org/submitOrderBatch.xs"> MR - 30 Aug 2005 10:07 GMT sorry to keep being a pain... but
i get the trace using the proxy, but i now timeout when i use the proxy, and it works fine when i don't. is there something else i need to change? thanks again
> If you start proxyTrace you must supply a port number, the default is > 8080. So the proxy on your PC is http://localhost:8080. This address must [quoted text clipped - 222 lines] >>>>>>>>>>>> - <submitOrderBatch CustomerBatchID="58" >>>>>>>>>>>> xmlns="http://tempuri.org/submitOrderBatch.xs"> Stefan Misch - 01 Sep 2005 13:07 GMT Sorry for the delay...
I thought that the tools from www.pockesoap.com do not support HTTPS. So what do you mean by "I get the the trace"? Is this is the SSL encrypted SOAP message? Maybe that's why you get a timeout because the forwarding does not work. I can only trace standard HTTP SOAP messages using procyTrace.
Anyway, I found a tool that allows you to trace SOAP messages in both HTTP and HTTPS: Mindreef's SOAPscope 4.1 (see http://www.mindreef.com). You can download a fully functional trial. They supply a key that works for 4 days. It costs some bucks ($99?) but I guess it is worth the money if you have problems.
The steps to configure SOAPscope as a "forwarding SSL proxy" on your local machine are described in the online help. You must also modify your .NET client code (C# sample in online help provide).
I tested with my HTTPS based WS and got it working.
> sorry to keep being a pain... but > [quoted text clipped - 3 lines] > > (older messages deleted)
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|