1.SOAP是什么:基于XML的,简单通信协议
2.SOAP = HTTP + XML
SOAP请求可能是HTTP POST 或 HTTP GET请求
HTTP POST请求规定至少两个HTTP头:Content—Type 和 Content-Length
例子:
POST /item HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 250
3.SOAP的错误信息
SOAP 的 Fault 元素用于下列子元素
:供识别故障的代码
:可供人阅读的有关故障的说明
:有关是谁引发故障的信息
:存留涉及 Body 元素的应用程序专用错误信息
http://www.360doc.com/content/17/0103/19/32641359_619821541.shtml
//这篇文章说的很清楚
4.不同的版本使用不同的空间:
SOAP1.2使用http://www.w3.org/2003/05/soap-envelope
对于命名空间和SOAP1.1使用http://schemas.xmlsoap.org/soap/envelope/。
案例:
SOAP 请求:
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml;charset=utf-8
Content-Length: nnn
<?xmlversion="1.0"?><soap:Envelope
xmlns:soap=“http://www.w3.org/2001/12/soap-envelope”
soap:encodingStyle=“http://www.w3.org/2001/12/soap-encoding”>
soap:Bodyxmlns:m=“http://www.example.org/stock”
<m:GetStockPrice>
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>
SOAP响应:
HTTP/1.1 200 OK
Content-Type: application/soap+xml;charset=utf-8
Content-Length: nnn
<?xmlversion="1.0"?><soap:Envelope
xmlns:soap=“http://www.w3.org/2001/12/soap-envelope”
soap:encodingStyle=“http://www.w3.org/2001/12/soap-encoding”>
soap:Bodyxmlns:m=“http://www.example.org/stock”
<m:GetStockPriceResponse>
<m:Price>34.5</m:Price>
</m:GetStockPriceResponse>
</soap:Body>
</soap:Envelope>