[WebService] The difference between the Java WebService message format SOAP1.1 and SOAP1.2

Summary:

The current WebService protocols mainly include SOAP 1.1 and 1.2, and the CXF3 version also supports 1.1 and 1.2 at the same time.

The main difference between the WebService released by SOAP 1.1 and 1.2:

1. The namespaces of the two are different.

1.1 -> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

1.2 -> xmlns:soap="http://www.w3.org/2003/05/soap-envelope"

Note: This place only refers to the tag xmlns:soap

2. There are differences in HTTP header information.

1.1 -> 为Content-Type: text/xml; charset=UTF-8

1.2 -> 为Content-Type: application/soap+xml;charset=UTF-8

3. The content of the published WSDL is also different.

WSDL is the description language of Web Service. Different versions have different contents.

4. The SOAP message format is different.

Mainly reflected in the namespace of the message format.

The message format of SOAP1.1:

1. HTTP call parameters

1

2

3

4

5

6

7

8

POST http://127.0.0.1:8080/CXF3/webservice/what21Hello HTTP/1.1

Accept-Encoding: gzip,deflate

Content-Type: text/xml;charset=UTF-8

SOAPAction: ""

Content-Length: 288

Host: 127.0.0.1:8080

Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

2. The requested message format

1

2

3

4

5

6

7

8

9

10

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

          xmlns:cxf3="http://cxf3.what21.com/">

   <soapenv:Header/>

   <soapenv:Body>

      <cxf3:sayHi>

         <!--Optional:-->

         <text>?</text>

      </cxf3:sayHi>

   </soapenv:Body>

</soapenv:Envelope>

3. Response message format

1

2

3

4

5

6

7

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

   <soap:Body>

      <ns2:sayHiResponse xmlns:ns2="http://cxf3.what21.com/">

         <return>?</return>

      </ns2:sayHiResponse>

   </soap:Body>

</soap:Envelope>

The message format of SOAP1.2:

1. HTTP call parameters

1

2

3

4

5

6

7

POST http://127.0.0.1:8080/CXF3/webservice/what21Hello HTTP/1.1

Accept-Encoding: gzip,deflate

Content-Type: application/soap+xml;charset=UTF-8

Content-Length: 268

Host: 127.0.0.1:8080

Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

2. The requested message format

1

2

3

4

5

6

7

8

9

10

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"

         xmlns:cxf3="http://cxf3.what21.com/">

   <soap:Header/>

   <soap:Body>

      <cxf3:sayHi>

         <!--Optional:-->

         <text>?</text>

      </cxf3:sayHi>

   </soap:Body>

</soap:Envelope>

3. Response message format

1

2

3

4

5

6

7

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

   <soap:Body>

      <ns2:sayHiResponse xmlns:ns2="http://cxf3.what21.com/">

         <return>?</return>

      </ns2:sayHiResponse>

   </soap:Body>

</soap:Envelope>

From the above content, we can see the difference between SOAP 1.1 and SOAP 1.2 very intuitively.

CXF3 releases SOAP1.2 services, please refer to:

http://www.what21.com/sys/view/java_webservice_1478011770049.html

Reference article

http://www.what21.com/sys/view/java_webservice_1478013505272.html

Guess you like

Origin blog.csdn.net/xiaoxiao_su123/article/details/111479626