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

本文关键字:SOAP 消息 是什么 服务 Web 方法 帮助 ASMX | 更新日期: 2023-09-27 17:54:57

我目前正在学习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>

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

这些是SOAP协议中编码的消息,. net为您将其放在"黑盒"中,因此您不必自己处理SOAP消息的创建和解析。