Skip to main content

SoapRequestMessage (Method Keyword)

Use this when multiple web methods have the same SoapAction. This keyword specifies the name of the top element in the SOAP body of the request message, in the default scenario. Applies only in a class that is defined as a web service or web client.

Usage

To specify the name of the top element in the SOAP body of the request message, use the following syntax:

Method name(formal_spec) As returnclass [ WebMethod, SoapAction = "MyAct", SoapRequestMessage="MyReqMessage" ] 
{    //implementation }

Where soaprequestmessage is a valid XML identifier.

Details

Note:

This keyword has an effect only for wrapped document/literal messages.

This keyword specifies the name of the top element in the SOAP body of the request message, for wrapped document/literal messages. (Wrapped document/literal messages are the default. For information, see Examples of Message Variations in Creating Web Services and Web Clients.)

Specify this keyword if you use the same value for SoapAction for multiple web methods in the same web service. Otherwise, this keyword is not generally needed.

Relationship to WSDL

The SoapRequestMessage keyword affects the <message> sections 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 = MyAct,SoapRequestMessage=MyReqMessage, WebMethod ]
{
    Quit a + b
}

For this web service, the WSDL includes the following:

<message name="AddSoapIn">
   <part name="parameters" element="s0:MyReqMessage"/>
</message>
<message name="AddSoapOut">
   <part name="parameters" element="s0:AddResponse"/>
</message>

These elements are correspondingly defined in the <types> section.

By default, if the method did not specify the SoapRequestMessage keyword, the <message> sections would instead be like the following:

<message name="AddSoapIn">
   <part name="parameters" element="s0:Add"/>
</message>
<message name="AddSoapOut">
   <part name="parameters" element="s0:AddResponse"/>
</message>

If you use the SOAP Wizard to generate an InterSystems IRIS web service 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:

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:s='http://www.w3.org/2001/XMLSchema'>
  <SOAP-ENV:Body>
    <MyReqMessage xmlns="http://www.myapp.org"><a>1</a><b>2</b></MyReqMessage>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

In contrast, if the method did not specify the SoapRequestMessage keyword, the message would instead be like the following:

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:s='http://www.w3.org/2001/XMLSchema'>
  <SOAP-ENV:Body>
    <Add xmlns="http://www.myapp.org"><a>1</a><b>2</b></Add>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

See Also

FeedbackOpens in a new tab