为什么我的 .NET Web 服务 XML 与其他人的不同?

发布于 2024-12-27 17:25:27 字数 2702 浏览 0 评论 0原文

我对 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北城半夏 2025-01-03 17:25:27

如果您指的是肥皂与肥皂,那么它实际上并不重要。这些节点是命名空间,以便使用者知道文档的格式。实际上,知道 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文