Content-Type for SOAP 1.2 XML with Action
Set the Content-Type header for SOAP 1.2 web service requests with the action parameter. Covers application/soap+xml vs text/xml.
XML/SOAP
Detailed Explanation
SOAP 1.2 Content-Type
SOAP 1.2 uses application/soap+xml as its media type, replacing the text/xml used by SOAP 1.1. The action parameter specifies which operation to invoke on the web service.
The Header Value
Content-Type: application/soap+xml; charset=utf-8; action="http://example.com/CalculatePrice"
SOAP 1.1 vs 1.2
| Feature | SOAP 1.1 | SOAP 1.2 |
|---|---|---|
| Content-Type | text/xml |
application/soap+xml |
| Action | SOAPAction HTTP header | action parameter in Content-Type |
| Default charset | US-ASCII | UTF-8 |
SOAP 1.1 Example
For legacy SOAP 1.1 services, use a separate SOAPAction header:
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://example.com/CalculatePrice"
SOAP 1.2 Request Body
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<CalculatePrice xmlns="http://example.com/">
<item>Widget</item>
<quantity>5</quantity>
</CalculatePrice>
</soap:Body>
</soap:Envelope>
curl Example
curl -X POST \
-H 'Content-Type: application/soap+xml; charset=utf-8; action="http://example.com/CalculatePrice"' \
-d @request.xml \
https://service.example.com/soap
Use Case
Use this when integrating with SOAP 1.2 web services, common in enterprise systems, banking APIs, and government services. Many .NET WCF and Java JAX-WS services use SOAP 1.2.