SoapMessageName (Method Keyword)
Usage
To override the default name of the <part> element of the response message, use the following syntax:
Method name(formal_spec) As returnclass [ WebMethod, SoapMessageName = MyResponse ]
{ //implementation }
Where soapmessagename is any identifier that is valid in XML.
Details
This keyword has an effect only for a web method that uses SoapBindingStyle equal to document (which is the default).
This keyword specifies the name of the child element of the body of the response message.
Default
If you omit this keyword, the message name is the name of the web method with Response appended to the end.
The name of the web method is taken from the web method definition in the web service; this can be changed only by renaming that method.
Relationship to WSDL
The SoapMessageName keyword affects the <messages> and <types> 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 [ SoapMessageName=MyResponseMessage,WebMethod ]
{
Quit a + b
}
For this web service, the <types> and <messages> sections of the WSDL are as follows:
<types>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.mynamespace.org">
<s:element name="Add">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" name="a" type="s:decimal"/>
<s:element minOccurs="0" name="b" type="s:decimal"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="MyResponseMessage">
<s:complexType>
<s:sequence>
<s:element name="AddResult" type="s:decimal"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</types>
<message name="AddSoapIn">
<part name="parameters" element="s0:Add"/>
</message>
<message name="AddSoapOut">
<part name="parameters" element="s0:MyResponseMessage"/>
</message>
By default, if the method did not specify the SoapMessageName keyword, the AddSoapOut message would have included an element named AddResponse instead of MyResponseMessage.
Notice that the SoapMessageName does not affect the child element (for example, AddResult) of the response message.
If you generate a web service or client from a WSDL, InterSystems IRIS sets this keyword as appropriate for that WSDL.
Effect on SOAP Messages
The web service might send a response message like the following:
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Body>
<MyResponseMessage xmlns="http://www.mynamespace.org">
<AddResult>42</AddResult>
</MyResponseMessage>
</SOAP-ENV:Body>
By default, if the method did not specify the SoapMessageName keyword, the <MyResponseMessage> element would have been <AddResponse> instead.