Caché Class Definition Reference
SoapAction
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

Specifies the SOAP action to use in the HTTP header when invoking this method as a web method via HTTP. Applies only in a class that is defined as a web service or web client.
Usage
To specify the SOAP action to use in the HTTP header when using this method as a web method, use the following syntax:
Method name(formal_spec) As returnclass [ WebMethod, SoapAction = soapaction ]
{
   //implementation
}
Where soapaction is one of the following:
Details
The SOAP action for a web method is generally used to route the request SOAP message. For example, a firewall could use it to appropriately filter SOAP request messages. A Caché web service uses the SOAP action, in combination with the message itself, to determine how to process the request message.
This keyword lets you specify the HTTP SOAP action to use when invoking this method as a web method. For SOAP 1.1, the SOAP action is included as the SOAPAction HTTP header. For SOAP 1.2, it is included within the Content-Type HTTP header.
Default
If you omit the SoapAction keyword, the SOAP action is formed as follows:
NAMESPACE/Package.Class.Method
Where NAMESPACE is the value of the NAMESPACE parameter for the web service, Package.Class is the name of the web service class, and Method is the name of the web method.
Relationship to WSDL
The SoapAction keyword affects the <binding> section of the WSDL for the web service. For example, consider the following web method:
Method Add(a as %Numeric,b as %Numeric) As %Numeric [ SoapAction = MySoapAction,WebMethod ]
{
    Quit a + b
}
For this web service, the <binding> section of the WSDL is as follows:
<binding name="MyServiceNameSoap" type="s0:MyServiceNameSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="Add">
        <soap:operation soapAction="MySoapAction" style="document"/>
        <input>
            <soap:body use="literal"/>
        </input>
        <output>
            <soap:body use="literal"/>
        </output>
    </operation>
</binding>
By default, if the method did not specify the SoapAction keyword, the <soap:operation> element might instead be like the following:
<soap:operation soapAction="http://www.mynamespace.org/ROBJDemo.BasicWS.Add" style="document"/>
If you use the SOAP Wizard to generate a Caché web service or client from a WSDL, Caché sets this keyword as appropriate for that WSDL.
Effect on the Message
For the web method shown previously, the web service expects a request message of the following form (for SOAP 1.1):
POST /csp/gsop/ROBJDemo.BasicWS.cls HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; Cache;)
Host: localhost:8080
Connection: Close
Accept-Encoding: gzip
SOAPAction: MySoapAction
Content-Length: 379
Content-Type: text/xml; charset=UTF-8

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope >...
By default, if the method did not specify the SoapAction keyword, the SOAPAction line might instead be like the following:
SOAPAction: http://www.mynamespace.org/ROBJDemo.BasicWS.Add
Note that for SOAP 1.2, the details are slightly different. In this case, the web service expects a request message of the following form:
POST /csp/gsop/ROBJDemo.BasicWS.cls HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; Cache;)
Host: localhost:8080
Connection: Close
Accept-Encoding: gzip
Content-Length: 377
Content-Type: application/soap+xml; charset=UTF-8; action="MySoapAction"

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope >...
See Also