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?