SoapAction (Method Keyword)
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:
-
"[ default ]" — This causes InterSystems IRIS to use the default value for the SOAP action, which is NAMESPACE/Package.Class.Method
-
"customValue" — This causes InterSystems IRIS to use customValue as the SOAP action. The value should be a URI that identifies the intent of the SOAP request.
If you specify a custom value, either it must be unique within for each web method in the web service or you must specify the SoapRequestMessage keyword for each web method (and use unique values for that keyword).
-
"" — This causes InterSystems IRIS to use an empty value as the SOAP action. This scenario is rare.
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. An InterSystems IRIS web service 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 generate an InterSystems IRIS web service or client from a WSDL, InterSystems IRIS 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; InterSystems IRIS;)
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; InterSystems IRIS;)
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 >...