折り返しありのドキュメント/リテラル・メッセージのために、要求メッセージの SOAP 本文内で最上位要素名をこのキーワードで指定します。(折り返しありのドキュメント/リテラル・メッセージが既定となります。詳細は、"Web サービスおよび Web クライアントの作成" の “メッセージ・バリエーションの例” を参照してください。)
WSDL との関係
SoapRequestMessage キーワードは、Web サービスのための WSDL の <message> セクションに影響します。例えば、以下の Web メソッドを考えてみます。
Method Add(a as %Numeric,b as %Numeric) As %Numeric [ SoapAction = MyAct,SoapRequestMessage=MyReqMessage, WebMethod ]
{
Quit a + b
}
この Web サービスでは、WSDL には以下のものが含まれています。
<message name="AddSoapIn">
<part name="parameters" element="s0:MyReqMessage"/>
</message>
<message name="AddSoapOut">
<part name="parameters" element="s0:AddResponse"/>
</message>
これらの要素は、それに対応して <types> セクションで定義されます。
既定では、メソッドで SoapRequestMessage キーワードを指定しないと、<message> のセクションが次のようになる場合があります。
<message name="AddSoapIn">
<part name="parameters" element="s0:Add"/>
</message>
<message name="AddSoapOut">
<part name="parameters" element="s0:AddResponse"/>
</message>
SOAP ウィザードを使用して WSDL から InterSystems IRIS Web サービスのサービスまたはクライアントを生成する場合、その WSDL に応じてこのキーワードが設定されます。
メッセージへの影響
前述の Web メソッドの場合、Web サービスでは、次の形式の要求メッセージを想定しています。
<?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>
その一方で、メソッドで SoapRequestMessage キーワードを指定しないと、メッセージが次のようになる場合があります。
<?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>