我的工作,提供了一个SOAP接口的系统上。其中一个将使用该接口的系统在Delphi 7中进行了编码。该Web服务使用WCF(基本http绑定,SOAP 1.1)开发。德尔福SOAP信封和WCF
如果我使用SOAP UI(JAVA),服务工作正常。但是,德尔福似乎在这里做特别的事情;)
这是消息怎么看起来像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开发人员,但我开发了一个简单的测试客户端来看看是怎么回事错误。这是德尔福发送的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抛出一个错误是在德语...;)
居wurde DAS结束元素 “身体” AUS命名空间 “http://schemas.xmlsoap.org/soap/envelope/” erwartet。 Gefunden wurde“Element”NS2:GetCustomerRequest“aus Namespace”http://services.xxx.de/xxx“”。 Zeile 1,位置599
意味着像
身体预期。但是却发现了元素“NS2:GetCustomerReques”。
现在我的问题是:我可以以某种方式改变Delphi创建信封的方式吗?或者是让WCF以这种消息格式工作的方式?任何帮助是极大的赞赏!
问题不在NS1 NS2部分。问题在于德尔福在制造结构上不正确的XML。看来,Web服务期待GetCustomerRequest被嵌套在GETCUSTOMER,但德尔福的客户端没有嵌套GetCustomerRequest元素。我不知道如何解决它。您是否使用WCF服务中的WSDL生成了Delphi客户端? – 2010-03-18 22:17:58