我正在开发一个提供SOAP接口的系统。其中一个将使用该接口的系统是用Delphi 7编码的。Web服务是使用WCF、基本的HTTP绑定和SOAP 1.1开发的。
如果我使用SOAP UI(JAVA),服务正常工作。但是Delphi似乎在这里做了一些特殊处理;)
这是SOAP UI中消息的样子:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.xxx.de/xxx">
<soapenv:Header/>
<soapenv:Body>
<ser:GetCustomer>
<!--Optional:-->
<ser:GetCustomerRequest> <!-- this is a data contract -->
<ser:Id>?</ser:Id>
</ser:GetCustomerRequest>
</ser:GetCustomer>
</soapenv:Body>
</soapenv:Envelope>
我不是Delphi开发人员,但是我开发了一个简单的测试客户端来查看问题所在。这就是Delphi发送的SOAP信封。
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS2="http://services.xxx.de/xxx">
<NS1:GetCustomer xmlns:NS1="http://services.xxx.de/xxx">
<GetCustomerRequest href="#1"/>
</NS1:GetCustomer>
<NS2:GetCustomerRequest id="1" xsi:type="NS2:GetCustomerRequest">
<Id xsi:type="xsd:int">253</Id>
</NS2:GetCustomerRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
在 WCF 中出现了德语错误... ;)
Endelement "Body" 在命名空间 "http://schemas.xmlsoap.org/soap/envelope/" 中未找到,反而找到命名空间为 "http://services.xxx.de/xxx" 的元素 "NS2:GetCustomerRequest"。第一行,第599个字符。
意思是:
预期的是 Body 元素,但实际上找到的是 NS2:GetCustomerRequest 元素。
现在我的问题是:我是否能改变 Delphi 创建邮件的方式?或者有没有其他方法让 WCF 能够处理这种消息格式?非常感谢您的帮助!