SOAPAction
The HTTP SOAPAction request header names the intent of a
SOAP 1.1 request as a quoted URI, so a service or a firewall
routes or filters the message before parsing the XML
envelope in the body. The header belongs to the SOAP 1.1 HTTP
binding. SOAP 1.2 dropped the header and moved the same value
into the action parameter of the application/soap+xml
media type.
Usage
A SOAP 1.1 request is an HTTP POST with an XML
envelope in the body and a Content-Type of
text/xml, in practice text/xml; charset=utf-8. The SOAP
1.1 HTTP binding requires every such request to carry the
SOAPAction header. The value is a URI naming the intent
of the message. SOAP places no restriction on the format or
specificity of the URI and does not require it to resolve.
The value is a label for dispatch, not an address to fetch.
Servers read the header before touching the body. A SOAP
endpoint hosting several operations looks up the handler for
the action, and a firewall or gateway allows or blocks a
request on the action alone, without parsing XML. The
Web Services Interoperability (WS-I) Basic Profile limits
how far a receiver leans on the header: a receiver uses
the value for dispatch and never depends on the value to
process the message correctly, since the envelope remains
the authoritative description of the request. The IANA
registration of the application/soap+xml media type makes
the same point for SOAP 1.2, warning that the action is not
a security mechanism and that dispatch or filtering
decisions based on it are confirmed against the envelope.
The value comes from the service description. A WSDL 1.1
document sets it per operation through the soapAction
attribute of the soap:operation element, and the client
copies the attribute value into the header as given. A
relative value stays relative, since the WSDL note forbids
making it absolute at request time. The Basic Profile adds
the quoting rules: the header value is always a quoted
string, it equals the WSDL attribute when one is present,
and it is the quoted empty string "" when the attribute is
absent or empty. The profile allows a receiver to answer an
unquoted value with a fault.
The IANA HTTP field registry lists the header with permanent
status under the spelling SoapAction, referencing SOAP
1.1. Header names are case-insensitive, and the W3C note and
the toolkits write SOAPAction.
Values
Quoted URI
A quoted absolute or relative URI identifies the intent of
the message. Services commonly build the URI from the
service namespace and the operation name. ASP.NET Web
Services default to http://tempuri.org/MethodName until
the developer sets a namespace.
SOAPAction: "http://example.re/stock/GetLastTradePrice"
Empty string
The quoted empty string says the intent of the message is
given by the request URI. The SOAP 1.1 note and the Basic
Profile both use the form, and a WSDL without a soapAction
attribute, or with an empty one, maps to this value.
SOAPAction: ""
No value
A header with no value at all says the sender gives no indication of intent. The SOAP 1.1 grammar makes the quoted URI optional, so the bare field name is a legal form. The form is distinct from a missing header: the header is still present, which satisfies toolkits that fault on absence, and from the empty string, which points at the request URI.
SOAPAction:
Example
A client calls the GetLastTradePrice operation of a SOAP
1.1 service. The action matches the soapAction attribute
in the service WSDL, the body is a text/xml envelope, and
the method is POST.
POST /stock HTTP/1.1
Host: api.example.re
Content-Type: text/xml; charset=utf-8
Content-Length: 263
SOAPAction: "http://example.re/stock/GetLastTradePrice"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetLastTradePrice xmlns="http://example.re/stock">
<symbol>EXR</symbol>
</GetLastTradePrice>
</soap:Body>
</soap:Envelope>
The service answers with a 200 and a response envelope. The response carries no SOAPAction header, since the header describes the request.
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 278
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetLastTradePriceResponse xmlns="http://example.re/stock">
<price>34.5</price>
</GetLastTradePriceResponse>
</soap:Body>
</soap:Envelope>
When the action names an operation the endpoint does not
offer, the SOAP 1.1 binding requires a 500 with a SOAP
Fault in the body. The faultcode names the sender as the
source of the problem.
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=utf-8
Content-Length: 323
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unrecognized SOAPAction "http://example.re/stock/GetQuote"</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
SOAP 1.2 and the action parameter
SOAP 1.2 removed the SOAPAction header from its HTTP
binding. The intent of a message travels instead in the
action parameter of the application/soap+xml
media type, which also replaces text/xml
as the Content-Type of SOAP 1.2 messages.
The parameter is an absolute URI, never empty, and optional.
Receivers treat the parameter as a hint to speed up dispatch
and keep processing messages without it. The SOAP Action
Feature in the SOAP
1.2 adjuncts defines the property behind the parameter, and
the HTTP binding fills the parameter from that property.
Content-Type: application/soap+xml; charset=utf-8; action="http://example.re/stock/GetLastTradePrice"
WS-Addressing moved the action into the envelope itself as
the wsa:Action header block, so the intent survives
transports other than HTTP. The SOAP 1.1 binding of
WS-Addressing keeps the HTTP header and ties the two
together: the SOAPAction value is either the wsa:Action
value in quotes or the empty string "", and any other value
produces an Invalid Message Addressing Property fault. The
empty form lets a sender hide the action inside a signed or
encrypted envelope. A receiver that finds wsa:Action and
SOAPAction disagreeing raises an Action Mismatch fault.
Failure modes
An unrecognized action returns a 500 with a SOAP Fault envelope. The SOAP 1.1 binding maps every SOAP processing error to 500, so a wrong, misspelled or stale action looks like a server error at the HTTP layer while the body names the real cause. Windows Communication Foundation (WCF) reports the case with the fault text "The message with Action '...' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher", where the quoted action is the one the client sent, often empty.
A missing header on a server requiring it also surfaces as a
500 fault in SOAP 1.1 deployments. The original Apache Axis
servlet raises a Client.NoSOAPAction fault with the string
"no SOAPAction header!" and answers with 500, which is why
the usual fix for a hand-written client is to add
SOAPAction: "" rather than to leave the header out. SOAP
1.2 receivers map a fault blamed on the sender to 400
instead, and the 1.2 binding answers a malformed request
with 400 before any envelope is read.
A wrong media type returns 415 under the SOAP 1.2
binding, which lists an unsupported message encapsulation
as a 415 alongside 400 for a malformed request and 405 for
a method other than POST or GET. Deployments differ: the
European Commission's VAT validation service answers a
text/plain body and a non-envelope text/xml body alike
with a 400 and an empty body.
A wsa:Action that disagrees with the HTTP header returns a
fault under WS-Addressing, and an unquoted value draws a
fault from a strict Basic Profile receiver. The fix in every case
starts at the WSDL: copy the soapAction attribute of the
operation into the header exactly, with quotes, or send ""
when the attribute is absent or empty, and pair the header
with Content-Type: text/xml; charset=utf-8 for SOAP 1.1
or application/soap+xml with the action parameter for
SOAP 1.2.
Where the header still appears
WSDL 1.1 remains the main source of SOAPAction values.
The soap:operation element carries a soapAction
attribute per operation, required for the HTTP binding and
without a default. Payment and government services published
as WSDL show both common patterns. The PayPal SOAP API WSDL
sets soapAction="" on every operation, and the European
Commission's VIES VAT number validation WSDL does the same,
so clients send SOAPAction: "" and the request URI carries
the intent. The Cybersource SOAP toolkit WSDL sets the
relative value soapAction="runTransaction", which the
client sends as SOAPAction: "runTransaction" without
resolving it.
In .NET, ASP.NET Web Services (ASMX) expose the header as
the Action property of SoapDocumentMethodAttribute, with
the http://tempuri.org/MethodName default, and publish the
value into the generated WSDL. WCF's basicHttpBinding
implements SOAP 1.1 per the Basic Profile and routes
incoming messages by the SOAPAction header. Operations
declare the value through the Action property of
OperationContractAttribute, and an operation with
Action="*" catches messages whose action matches no
contract, which is the documented way to handle
unrecognized actions instead of returning the mismatch
fault.
In Java, Jakarta XML Web Services (the successor to JAX-WS)
sets the value from the action element of the @WebMethod
annotation. On the client, the BindingProvider request
context exposes two properties: a boolean telling the
runtime whether to send a configured value, false by default
and true when WS-Addressing is enabled, and the URI itself,
which also feeds wsa:Action when addressing is on.
SAP integration products carry the header on both sides of
an integration flow. The SAP Cloud Integration SOAP receiver
adapter lists SOAPAction as a supported header and lets
a Groovy script set it, and the classic Exchange
Infrastructure SOAP adapter configures a default value and
a selection method through the XMBWS.DefaultSOAPAction and
XMBWS.UseSOAPAction parameters.
History
The header appeared in the SOAP 1.1 W3C Note of 8 May 2000,
whose HTTP binding made it mandatory on every SOAP request
and gave firewalls the header as a filtering hook. WSDL 1.1,
published as a W3C Note on 15 March 2001, added the
soapAction attribute so service descriptions state the
value per operation.
During the SOAP 1.2 work in 2001, the XML Protocol Working
Group proposed making the header optional and reserving a
427 "SOAPAction Required" status code, with a
Required-SOAPAction response header telling a client which
value to resend. The SOAP 1.2 Recommendation of 24 June 2003
went further and removed the header from the HTTP binding in
favour of the action parameter of application/soap+xml,
registered with IANA in September 2004. The 427 code was
sought from IANA but never assigned and remains unassigned
in the status code registry.
The WS-I Basic Profile 1.1 of August 2004 fixed the quoting
rules for SOAP 1.1 implementations, and WS-Addressing 1.0,
a W3C Recommendation of 9 May 2006, introduced wsa:Action
and defined how the SOAP 1.1 binding keeps SOAPAction
consistent with it.
See also
- Content-Type
- Media types
- POST
- 500
- 415
- 400
- Accept
- Authorization
- HTTP headers
- Simple Object Access Protocol (SOAP) 1.1, section 6.1.1 (W3C Note)
- SOAP Version 1.2 Part 2: Adjuncts, HTTP binding and action feature (W3C)
- SOAP Version 1.2 Part 0: Primer, changes from SOAP 1.1 (W3C)
- RFC 3902: The "application/soap+xml" media type
- IANA media type registration: application/soap+xml
- Web Services Description Language (WSDL) 1.1, section 3.4 soap:operation (W3C Note)
- WS-I Basic Profile 1.1
- Web Services Addressing 1.0 - SOAP Binding (W3C)
- Microsoft Learn: SoapDocumentMethodAttribute.Action
- Microsoft Learn: OperationContractAttribute.Action
- Microsoft Learn: Interoperability with ASP.NET Web Services
- Jakarta XML Web Services: BindingProvider
- SAP Help: Configure the SOAP (SOAP 1.x) Receiver Adapter
- IANA HTTP Field Name Registry