In this blog post, let us see about how to identify Simple Object Access Protocol (SOAP) version in a message. Sometimes, you will be skeptical about the version of your SOAP version in a message. There are two versions of SOAP being widely used: SOAP 1.1 and SOAP 1.2.
Table of Contents
Identify SOAP Version
Method 1: Using Namespaces
By checking the namespaces in the message helps you to identify the SOAP version. Below are the specifications.
SOAP 1.1: http://schemas.xmlsoap.org/soap/envelope/
SOAP 1.2: http://www.w3.org/2003/05/soap-envelope
Below is the sample xml message which has the envelope http://schemas.xmlsoap.org/soap/envelope/ which is SOAP 1.1 version.
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Â Â <soapenv:Body> Â Â Â <listUsers xmlns="http://ejb3.examples.itko.com/" /> Â </soapenv:Body> </soapenv:Envelope>
Method 2: SOAP Action Header
Typically SOAP 1.1 will have the content type as text/xml. Below is the sample header information.
POST /YourService HTTP/1.1 Content-Type: text/xml; charset="utf-8" Content-Length: xxx SOAPAction: "urn:uuid:youraction"
But SOAP 1.2 will have the content type as application/soap+xml. Below is the sample header information.
Method 3: Fault Information
- Names of the fault elements will look different.
- SOAP 1.1 fault elements are not namespace qualified, but all the SOAP 1.2 elements are namespace qualified.
- SOAP 1.1 uses the lower case letters in the fault elements.
- SOAP 1.2 Code elements can have the sub codes within it that describe the SOAP fault hierarchy.
Visit these links for more details: http://www.w3.org/TR/2000/NOTE-SOAP-20000508/ and http://www.w3.org/TR/soap12-part1/#firstexample