SOAP HTTP绑定
? HTTP協(xié)議
? ?HTTP在TCP/IP之上進(jìn)行通信。HTTP客戶機(jī)使用TCP連接到HTTP服務(wù)器。在建立連接之后,客戶機(jī)可向服務(wù)器發(fā)送HTTP請(qǐng)求消息:
? ?SOAP HTTP Binding
?soap方法指的是遵守SOAP編碼規(guī)則的HTTP請(qǐng)求/響應(yīng)。
? ?HTTP+XML=SOAP
? SOAP請(qǐng)求可能是HTTP POST或HTTP GET
? HTTP Post請(qǐng)求規(guī)定至少兩個(gè)HTTP頭:Content-Type和Content-Length。
? Content-Type
? ?SOAP的請(qǐng)求和響應(yīng)的Content-Type頭可定義消息的MIME類型,以及用于請(qǐng)求或響應(yīng)的XML主體的字符編碼
? ?Content-Type:MIMEType;charset=character-encoding
POST /item HTTP/1.1 Content-Type: application/soap+xml; charset=utf-8 ? Content-Length
SOAP的
POST /item HTTP/1.1 Content-Type: application/soap+xml; charset=utf-8 Content-Length: 250 請(qǐng)求和響應(yīng)的Content-Length頭規(guī)定請(qǐng)求或響應(yīng)的主體的字節(jié)數(shù)
一個(gè) SOAP 實(shí)例
在下面的例子中,一個(gè) GetStockPrice 請(qǐng)求被發(fā)送到了服務(wù)器。此請(qǐng)求有一個(gè) StockName 參數(shù),而在響應(yīng)中則會(huì)返回一個(gè) Price 參數(shù)。此功能的命名空間被定義在此地址中: "http://www.example.org/stock"
SOAP 請(qǐng)求:
POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn<?xml version="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:Body xmlns:m="http://www.example.org/stock"><m:GetStockPrice><m:StockName>IBM</m:StockName></m:GetStockPrice></soap:Body></soap:Envelope>SOAP 響應(yīng):
HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn<?xml version="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:Body xmlns:m="http://www.example.org/stock"><m:GetStockPriceResponse><m:Price>34.5</m:Price></m:GetStockPriceResponse></soap:Body></soap:Envelope>
? ??
總結(jié)
以上是生活随笔為你收集整理的SOAP HTTP绑定的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。