为什么我的 .NET Web 服务 XML 与其他人的不同?
我对 .NET Web 服务不熟悉,并且对这个问题感到非常困惑。 TCP 查看器显示我的测试应用程序与我的 Web 服务通信形成其 XML,如下所示:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetSupply xmlns="http://webservices.florecom.org/commercial/customer/">
<Request>
<SupplyRequest>
<Header xmlns="urn:fec:florecom:xml:data:draft:SupplyStandardMessage:5">
<UserName>xxx</UserName>
<Password>xxx</Password>
<MessageDateTime>2012-01-17T14:59:44.0438037+02:00</MessageDateTime>
<MessageSerial>0</MessageSerial>
</Header>
<Body xmlns="urn:fec:florecom:xml:data:draft:SupplyStandardMessage:5">
<SupplyRequestDetails>
<SupplyRequestLine xmlns="urn:fec:florecom:xml:data:draft:ReusableAggregateBusinessInformationEntity:3"/>
</SupplyRequestDetails>
</Body>
</SupplyRequest>
</Request>
</GetSupply>
</s:Body>
</s:Envelope>
但我的 Web 服务正在从另一家公司接收 XML,如下所示:
<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>
<fsm:SupplyRequest xmlns:qdt="urn:un:unece:uncefact:data:draft:QualifiedDataType:5" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:4" xmlns:ram="urn:un:unece:uncefact:data:draft:ReusableAggregateBusinessInformationEntity:3" xmlns:fsm="urn:fec:florecom:xml:data:draft:SupplyStandardMessage:5">
<fsm:Header>
<fsm:UserName>xxx</fsm:UserName>
<fsm:Password>xxx</fsm:Password>
<fsm:MessageID>634617184436505019</fsm:MessageID>
<fsm:MessageDateTime>2012-01-09T15:07:23.6505019+01:00</fsm:MessageDateTime>
<fsm:MessageSerial>0</fsm:MessageSerial>
</fsm:Header>
<fsm:Body>
<fsm:SupplyRequestDetails>
<SupplyRequestLine xmlns="urn:fec:florecom:xml:data:draft:ReusableAggregateBusinessInformationEntity:3"/>
</fsm:SupplyRequestDetails>
</fsm:Body>
</fsm:SupplyRequest>
</soap:Body>
</soap:Envelope>
有人可以帮助解释原因吗?这些是不同版本的 SOAP 吗?谢谢
更新
有趣的是,在这种情况下(使用第二条 XML 消息)发生的问题是,当服务方法被命中时(使用断点来检查这一点并使用Fiddler).NET 无法绑定方法的参数(称为“Request”),因此其值仍为 NULL
Im new to .NET web services and am thoroughly confused with this issue. TCP Viewer shows that my test app talking to my web service forms its XML as follows:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetSupply xmlns="http://webservices.florecom.org/commercial/customer/">
<Request>
<SupplyRequest>
<Header xmlns="urn:fec:florecom:xml:data:draft:SupplyStandardMessage:5">
<UserName>xxx</UserName>
<Password>xxx</Password>
<MessageDateTime>2012-01-17T14:59:44.0438037+02:00</MessageDateTime>
<MessageSerial>0</MessageSerial>
</Header>
<Body xmlns="urn:fec:florecom:xml:data:draft:SupplyStandardMessage:5">
<SupplyRequestDetails>
<SupplyRequestLine xmlns="urn:fec:florecom:xml:data:draft:ReusableAggregateBusinessInformationEntity:3"/>
</SupplyRequestDetails>
</Body>
</SupplyRequest>
</Request>
</GetSupply>
</s:Body>
</s:Envelope>
But my web service is receiving XML from another company that looks like this:
<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>
<fsm:SupplyRequest xmlns:qdt="urn:un:unece:uncefact:data:draft:QualifiedDataType:5" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:4" xmlns:ram="urn:un:unece:uncefact:data:draft:ReusableAggregateBusinessInformationEntity:3" xmlns:fsm="urn:fec:florecom:xml:data:draft:SupplyStandardMessage:5">
<fsm:Header>
<fsm:UserName>xxx</fsm:UserName>
<fsm:Password>xxx</fsm:Password>
<fsm:MessageID>634617184436505019</fsm:MessageID>
<fsm:MessageDateTime>2012-01-09T15:07:23.6505019+01:00</fsm:MessageDateTime>
<fsm:MessageSerial>0</fsm:MessageSerial>
</fsm:Header>
<fsm:Body>
<fsm:SupplyRequestDetails>
<SupplyRequestLine xmlns="urn:fec:florecom:xml:data:draft:ReusableAggregateBusinessInformationEntity:3"/>
</fsm:SupplyRequestDetails>
</fsm:Body>
</fsm:SupplyRequest>
</soap:Body>
</soap:Envelope>
Can someone help explain why? Are these different versions of SOAP? Thanks
UPDATE
As a matter of interest, the problem that is occurring in this scenario (with the 2nd XML message) is that when the service method gets hit (used a breakpoint to check this and spoofed the message with Fiddler) .NET fails to bind the method's parameter (called 'Request') so its value remains NULL
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您指的是肥皂与肥皂,那么它实际上并不重要。这些节点是命名空间,以便使用者知道文档的格式。实际上,知道 http://schemas.xmlsoap.org/soap 定义的模式的人会以相同的方式处理它们/envelope
均指soap 1.1命名空间
If you are referring to the soap vs s its actually not really important. those nodes are the namespaces so that the consumer knows the format of the document. They will actually be processed identically by someone who knows the schema defined by http://schemas.xmlsoap.org/soap/envelope
Both refer to the soap 1.1 namespace