1

我有两个 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 消息,更重要的是如何修复它?

4

0 回答 0