【问题标题】:Why can't get SOAP 1.2 response from IIS为什么无法从 IIS 获得 SOAP 1.2 响应
【发布时间】:2013-01-21 15:07:13
【问题描述】:

我使用 C# 设置了一个 Web 服务,并在 IIS 6 中发布它,SOAP 1.2 请求和响应应该是这样的:

SOAP1.2 请求

POST /WebServices/EUWS.asmx HTTP/1.1
Host: 10.30.178.81
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Add xmlns="http://www.eutesttools.com">
      <num1>double</num1>
      <num2>double</num2>
    </Add>
  </soap12:Body>
</soap12:Envelope>

SOAP1.2 响应

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <AddResponse xmlns="http://www.eutesttools.com">
      <AddResult>double</AddResult>
    </AddResponse>
  </soap12:Body>
</soap12:Envelope>

但实际上当我发布此请求时:

Content-Type    application/soap+xml

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
    <soap12:Body>
        <Add xmlns="http://www.eutesttools.com">
        <num1>3</num1>
        <num2>5</num2>
    </Add>
</soap12:Body>
</soap12:Envelope>

然后我总是得到这样的回应:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
    <AddResponse xmlns="http://www.eutesttools.com">
        <AddResult>8</AddResult>
    </AddResponse>
</soap:Body>
</soap:Envelope>

为什么我不能得到描述的响应?

【问题讨论】:

    标签: .net web-services soap


    【解决方案1】:

    正确的反应。前缀无关紧要。

    【讨论】:

    • 谢谢。我想知道为什么前缀不一样?
    • 前缀不相关。它们可以是任何东西,只要它在文档中是唯一的。命名空间前缀只不过是命名空间本身的别名。只要它等同于http://www.w3.org/2003/05/soap-envelope,就意味着完全相同。
    猜你喜欢
    • 2020-07-17
    • 2019-08-20
    • 2021-12-02
    • 1970-01-01
    • 2020-08-25
    • 2021-07-18
    • 2018-02-20
    • 2020-12-11
    • 1970-01-01
    相关资源
    最近更新 更多