转自:http://blog.sina.com.cn/s/blog_5f044a4d0101gzli.html
WebService通过HTTP协议完成远程调用: (深入分析) – RPC
Soap1.1的命名空间:
Soap1.2 命名空间:
SOAP1.1的HTTP请求头:
Content-Type: text/xml; charset=UTF-8
Accept: **
User-Agent: Apache CXF 2.4.0
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:6767
Connection: keep-alive
Content-Length: 214
SOAP1.2的请求头:
POST /xe_cxf2.4_soap12_spring_web/ws/helloworldsoap12?wsdl HTTP/1.1
Content-Type: application/soap+xml;charset=UTF-8
Accept: */*
User-Agent: Apache CXF 2.4.0
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:6767
Connection: keep-alive
Content-Length: 214
SOAP1.1和1.2的WSDL文件的差别:
POST /WSShakespeare.asmx HTTP/1.1
Host: www.xmlme.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://xmlme.com/WebServices/GetSpeech"
<?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>
<GetSpeech xmlns="http://xmlme.com/WebServices">
<Request>string</Request>
</GetSpeech>
</soap:Body>
</soap:Envelope>
SOAP 1.2 request:
POST /WSShakespeare.asmx HTTP/1.1
Host: www.xmlme.com
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>
<GetSpeech xmlns="http://xmlme.com/WebServices">
<Request>string</Request>
</GetSpeech>
</soap12:Body>
</soap12:Envelope>
I see 3 differences:
SOAP 1.2 uses "application/soap+xml" as Content-Type and SOAP 1.1 uses "text/xml".
SOAP 1.2 does not use SOAPAction header line.
SOAP 1.2 uses "http://www.w3.org/2003/05/soap-envelope" as the envolope namespace and SOAP 1.1 uses "http://schemas.xmlsoap.org/soap/envelope/"