Last updated
SOAP 1.1 vs SOAP 1.2 Differences
Feature SOAP 1.1 SOAP 1.2
------- -------- --------
Namespace schemas.xmlsoap.org/... www.w3.org/2003/05/soap-envelope
Content-Type text/xml application/soap+xml
SOAPAction Separate HTTP header Part of Content-Type
Fault codes Client, Server Sender, Receiver
Examples
Example 1: Basic SOAP 1.1 Request
POST /service HTTP/1.1
Host: api.example.com
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://example.com/GetUser"
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://example.com/userservice">
<soap:Header/>
<soap:Body>
<tns:GetUser>
<tns:UserId>12345</tns:UserId>
</tns:GetUser>
</soap:Body>
</soap:Envelope>
Example 2: SOAP 1.2 Request
POST /service HTTP/1.1
Host: api.example.com
Content-Type: application/soap+xml; charset=utf-8; action="http://example.com/GetUser"
<?xml version="1.0" encoding="UTF-8"?>
<soap12:Envelope
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
xmlns:tns="http://example.com/userservice">
<soap12:Header/>
<soap12:Body>
<tns:GetUser>
<tns:UserId>12345</tns:UserId>
</tns:GetUser>
</soap12:Body>
</soap12:Envelope>
Example 3: SOAP Request with WS-Security (Username/Password)
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:tns="http://example.com/service">
<soap:Header>
<wsse:Security soap:mustUnderstand="1">
<wsse:UsernameToken>
<wsse:Username>myusername</wsse:Username>
<wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
mypassword
</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
<soap:Body>
<tns:GetAccountBalance>
<tns:AccountId>ACC-001</tns:AccountId>
</tns:GetAccountBalance>
</soap:Body>
</soap:Envelope>