WebService remote invocation via HTTP protocol: (in-depth analysis) –RPC
WebService only uses the HTTP POST method to transmit the data, does not use the Get method; --shaking hands, Wsdl-get,
? The contenttype of the normal HTTP post is
? application/x-www-form-urlencoded
? WebService ContentType--that is, the SOAP protocol based on HTTP
? Text/xml this is based on the soap1.1 protocol.
? Application/soap+xml this is based on the soap1.2 protocol.
The webservice is qualified from the data transfer format. The data used by WebService is based on XML format. The current standard webservice mainly uses the SOAP protocol in the data format. The SOAP protocol is actually a text protocol based on XML encoding specification.
Soap–simple Object Access protocol A simple pair of like-to-the-protocol. is a protocol that runs on top of the HTTP protocol. In fact, the HTTP protocol is the transfer of XML files, it becomes the SOAP protocol. The current version of SOAP is mainly SOAP1.1 and SOAP1.2.
SOAP1.1 and SOAP1.2 's namespace are different.
Soap1.1 namespaces:
xmlns:soap= "http://schemas.xmlsoap.org/soap/envelope/"
Soap1.2 namespaces:
xmlns:soap= "Http://www.w3.org/2003/05/soap-envelope"
You can view the class by
Javax.xml.ws.soap.SOAPBinding to see the constants inside.
? By default, Jdk1.6 only supports soap1.1
? That is: @BindingType (value=javax.xml.ws.soap.soapbinding.soap11http_binding)
jdk1.6 does not support 12 forms of access by default. Soap Elevation:
Transfer items to 1.2 via Bindingtype
Add the following annotations above the class to use the soap1.2 protocol:
[Email protected] (value=soapbinding.soap12http_binding)
or use binding in Applicationcontext.xml
?<</span>jaxws:binding>
? <</font>soap:soapbindingversion= "1.2"/>
? </</FONT>jaxws:binding>
There is a difference in header information between the 3.soap1.1 version and the SOAP1.2 version.
1.soap1.1 There is a SOAPAction request header.
2.soap1.2 does not have a SOAPAction request header.
4.soap1.1 and 1.2 wsdl file differences:
1. The main view is the name space.
2. The difference in defining the service section is as follows:
Soap1.1 is defined by: soap:address.
Soap1.2 is defined by: soap12:address. -jdk1.6 does not support 12 forms of access.
5. The two types of protocol requests in CXF are not the same.
1.soap1.1 to Content-type:text/xm;charset=utf-8
2.soap1.2 to Content-type:application/soap+xml;charset=utf-8
HTTP request header for SOAP1.1:
POST/XE_CXF2.4_SOAP12_SPRING_WEB/WS/HELLOWORLDSOAP12?WSDL http/1.1
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 's request header:
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 Request and SOAP1.2 request:
SOAP 1.1 Request:
Post/wsshakespeare.asmx http/1.1host:www.xmlme.com Content-type:text/xml; Charset=utf-8content-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>
SOAP1.2 Request:
Post/wsshakespeare.asmx http/1.1host:www.xmlme.com Content-type:application/soap+xml; Charset=utf-8content-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>
Differences between SOAP1.1 and SOAP1.2:
- 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.xmlsoa p.org/soap/envelope/"
The difference between Soap1.1 and Soap1.2