当前位置:K88软件开发文章中心编程语言XmlSOAP → 文章内容

SOAP 实例

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-14 2:17:33

SOAP 实例一个 SOAP 实例在下面的例子中,一个 GetStockPrice 请求被发送到了服务器。此请求有一个 StockName 参数,而在响应中则会返回一个 Price 参数。此功能的命名空间被定义在此地址中: "http://www.example.org/stock"SOAP 请求:POST /InStock HTTP/1.1Host: www.example.orgContent-Type: application/soap+xml; charset=utf-8Content-Length: nnn<?xml version="1.0"?><soap:Envelopexmlns: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 响应:HTTP/1.1 200 OKContent-Type: application/soap+xml; charset=utf-8Content-Length: nnn<?xml version="1.0"?><soap:Envelopexmlns: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>

SOAP 实例