webservice 相关 http+SOAP 报文范例 ,以及 soap1.1 和 soap 1.2 的区别

soap1.1 和 1.2 的区别主要表现在 
区别 (1)
http头的 Content-Type: 字段
1.1的 Content-Type: text/xml; charset=utf-8 
1.2的  Content-Type: application/soap+xml; charset=utf-8
区别(2)
http头的SOAPAction: 字段
1.1的要求有 SOAPAction:  字段,内容为 明明空间+方法名
1.2版本 不需要 SOAPAction: 字段
区别(3)
namespace不同
1.1版本的namespace  为  http://schemas.xmlsoap.org/soap/envelope/ 
1.2版本的namespace 为   http://www.w3.org/2003/05/soap-envelope
SOAP 1.2范例

SOAP 请求:

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 响应:

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>

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值