Content-Type for SOAP 1.1 (text/xml)
Set the Content-Type header for SOAP 1.1 web service requests using text/xml and the SOAPAction header. Covers migration to SOAP 1.2.
Detailed Explanation
SOAP 1.1 Content-Type
SOAP 1.1 uses text/xml as its Content-Type and sends the action in a separate SOAPAction HTTP header.
The Headers
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://example.com/GetWeather"
Key Differences from SOAP 1.2
In SOAP 1.1, the action is not part of the Content-Type. It goes in a dedicated SOAPAction header. This header:
- Must be present (even if empty:
SOAPAction: "") - Contains the URI identifying the intent of the message
- Is used by firewalls and routers for message routing
SOAP 1.1 Envelope
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:web="http://example.com/">
<soap:Body>
<web:GetWeather>
<web:City>Tokyo</web:City>
</web:GetWeather>
</soap:Body>
</soap:Envelope>
Charset Matters
Since text/xml defaults to US-ASCII when no charset is specified, always include charset=utf-8 to avoid encoding issues with international characters.
Migration Path
If you are building a new service, prefer SOAP 1.2 with application/soap+xml. SOAP 1.1 is considered legacy but remains widely deployed in enterprise environments.
curl Example
curl -X POST \
-H "Content-Type: text/xml; charset=utf-8" \
-H 'SOAPAction: "http://example.com/GetWeather"' \
-d @request.xml \
https://service.example.com/soap
Use Case
Use this when integrating with legacy SOAP 1.1 web services. Many enterprise systems, government APIs, and banking services still use SOAP 1.1 with text/xml.