1

I have two SOAP requests, of which one works and the other doesn't. The second one is created by a class generated directly from the WSDL and it seems to be wrong.

Working

Created by soapUI 4.0.1 from the WSDL file

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:ZWmGetEpc>
         <IpLgnum>XYZ</IpLgnum>
      </urn:ZWmGetEpc>
   </soapenv:Body>
</soapenv:Envelope>

Not Working

Created directly from code with a class generated by wsdl.exe

<?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>
        <ZWmGetEpc xmlns="urn:sap-com:document:sap:soap:functions:mc-style">
            <IpLgnum>XYZ</IpLgnum>
        </ZWmGetEpc>
    </soap:Body>
</soap:Envelope>

Error in SOAP

I determined the error in the second SOAP message: the namespace urn:sap-com:document:sap:soap:functions:mc-style is somehow not properly assigned to the element ZWmGetEpc. It should be:

<urn:ZWmGetEpc 
xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style">
        <IpLgnum>FIR</IpLgnum>
</urn:ZWmGetEpc>

Question

Now why does the class generate a wrong SOAP message and more importantly how can I fix it?

Julian
  • 408
  • 5
  • 16
  • 1
    Actually, the problem is `IpLgnum`, not `ZWmGetEpc`. – John Saunders Feb 21 '12 at 15:23
  • Did you receive any warnings from WSDL.EXE about WS-I BP-1 compliance? This may be an RPC/Encoded service, where there's disagreement about which namespace should be used for certain elements. You could try svcutil.exe instead of wsdl.exe, but I suspect that will have the same problem. – John Saunders Feb 21 '12 at 15:26

0 Answers0