3

When i use the "/messageContract" in my svcutil command, my soap message sends the action or operation in the header of the soap envelope and not the body. The remote endpoint is a vendor's Java based service which i have no control over.

I need the action to to be sent in the body but still use "/messageContract".

Does anyone know how to achieve this?

SOAP envelope WITH "/messageContract"

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">GetCapabilities</Action>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"></s:Body>
</s:Envelope>

SOAP envelope WITHOUT "/messageContract"

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header></s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetCapabilities xmlns="http://www.opengis.net/cat/csw/2.0.2"></GetCapabilities>
</s:Body>
</s:Envelope>

my svcutil command:

svcutil /target:code http://localhost/sarpilot/xml/mywisdl.wsdl /messageContract /out:WebService.cs /config:WebService.config
capdragon
  • 14,565
  • 24
  • 107
  • 153

1 Answers1

3

Are truly sure your target (Java-based) web service requires a Microsoft-based namespace element in the SOAP body instead of the SOAP header? That seems bogus to me.

<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">GetCapabilities</Action>

Most web services only need the Action in the HTTP header, not as part of the SOAP body:

POST /StockQuote HTTP/1.1
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
SOAPAction: "http://electrocommerce.org/abc#MyMessage"

<SOAP-ENV:Envelope...

Can you provide a raw, working SOAP request (including HTTP headers) for comparison? You can test it out independent from .NET by using this little web-page based client: Simplest SOAP example using Javascript. I assume from your other posting here which shows a "working" request that you really don't need the Microsoft Action element in your SOAP body.

Community
  • 1
  • 1
Mike Atlas
  • 8,193
  • 4
  • 46
  • 62
  • Thanks for your post. The target web service does NOT require a Microsoft-based namespace element. It does however require the operation to be in the BODY of the SOAP Request and not in the Header. That is why i need the firs to look more like the second soap request. Second soap request (SOAP envelope WITHOUT "/messageContract") is a RAW example of a working SOAP request. I tested it out independent of .NET using SOAPUI. – capdragon Mar 29 '11 at 17:41
  • Right, so you don't need the `Action` element in the body at all, just the actual *operation* element in the body. Where's the problem, then? – Mike Atlas Mar 29 '11 at 18:53
  • I would still like to use "/messageContract" because for some (weird) reason i thought it might make my code work. I GUESS THE REAL problem is still http://stackoverflow.com/questions/5460107/soap-xml-response-received-but-not-populating-response-object Should i close this post? It is pretty redonkulous now that you point it out. My real problem is the above link. – capdragon Mar 29 '11 at 19:03
  • Tell you what, i'll leave this open, but help me figure out why objects are not populating (http://stackoverflow.com/questions/5460107/soap-xml-response-received-but-not-populating-response-object) and i'll give you BOTH answers :) – capdragon Mar 29 '11 at 19:05