WSDL.exe中类生成的错误SOAP消息

时间:2012-02-21 15:02:12

标签: c# .net soap namespaces wsdl.exe

我有两个SOAP请求,其中一个有效,另一个没有。第二个是由直接从WSDL生成的类创建的,似乎是错误的。

工作

由SOAPUI 4.0.1从WSDL文件

创建
<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>

不工作

直接使用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>

SOAP

中的错误

我确定了第二条SOAP消息中的错误:命名空间urn:sap-com:document:sap:soap:functions:mc-style以某种方式未正确分配给元素ZWmGetEpc。它应该是:

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

问题

现在为什么该类会生成错误的SOAP消息,更重要的是我如何修复它?

0 个答案:

没有答案
相关问题