ASMX Web服务方法的帮助页面上的SOAP消息是什么?

时间:2011-05-04 15:46:35

标签: c# web-services soap asmx

我目前正在学习Web服务,在.asmx文件中进行示例练习之后,我注意到在示例方法输出页面下面有很多与SOAP相关的消息,如下所示,有人可以告诉我这些消息是什么?感谢。

SOAP 1.1 以下是SOAP 1.1请求和响应示例。显示的占位符需要替换为实际值。

POST /SecurityWebService/Service.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetSecurityInfo"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetSecurityInfo xmlns="http://tempuri.org/">
      <Code>string</Code>
    </GetSecurityInfo>
  </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetSecurityInfoResponse xmlns="http://tempuri.org/">
      <GetSecurityInfoResult>
        <Code>string</Code>
        <CompanyName>string</CompanyName>
        <Price>double</Price>
      </GetSecurityInfoResult>
    </GetSecurityInfoResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2 以下是SOAP 1.2请求和响应示例。显示的占位符需要替换为实际值。

POST /SecurityWebService/Service.asmx HTTP/1.1
Host: localhost
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>
    <GetSecurityInfo xmlns="http://tempuri.org/">
      <Code>string</Code>
    </GetSecurityInfo>
  </soap12:Body>
</soap12:Envelope>
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>
    <GetSecurityInfoResponse xmlns="http://tempuri.org/">
      <GetSecurityInfoResult>
        <Code>string</Code>
        <CompanyName>string</CompanyName>
        <Price>double</Price>
      </GetSecurityInfoResult>
    </GetSecurityInfoResponse>
  </soap12:Body>
</soap12:Envelope>

1 个答案:

答案 0 :(得分:0)

这些是以SOAP协议编码的消息。 .NET有点把它放在一个“黑盒子”中,这样​​你就不需要自己处理SOAP消息了。