WSIF サービスが JMS 宛先のサービスにアクセスできるようにする WSDL 拡張の作成

ネイティブ Java™ Message Service (JMS) プロバイダーを使用すると、Web Services Invocation Framework (WSIF) クライアントは、JMS 宛先で使用可能なサービスを Web サービスとして扱うことができます。この情報とそれに関連したコード・フラグメントを使用すると、Web サービス記述言語 (WSDL) 拡張を作成することができます。

始める前に

このトピックでは、WebSphere® Application Server のインストール時に、JMS プロバイダー (デフォルトのメッセージング・プロバイダー、または WebSphere MQ メッセージング・プロバイダーなどの他のプロバイダーのいずれか) が選択され、構成されていることを前提としています。 まだ実行されていない場合は、メッセージング・プロバイダーの選択の説明に従ってここで実行してください。

このタスクについて

JMS 用の WSDL 拡張は、 名前空間の接頭部 jms で識別されます。例えば、<jms:binding> のようになります。

サポートされているオペレーションは、片方向オペレーション (JMS point-to-point メッセージングの場合は send、JMS パブリッシュ/サブスクライブ・メッセージングの場合は publish)、 または要求/応答オペレーション (JMS point-to-point メッセージングの場合は send および receive) のいずれかです。したがって、WSDL オペレーションは、 入力メッセージのみを指定、または入力メッセージと出力メッセージを指定します。

ネイティブ JMS バインディングによるメッセージ・インターフェースを記述するオペレーションには、障害メッセージがありません。 メッセージ・スキーマや、メッセージ・プロパティーのセマンティクスに関する前提事項がないため、出力メッセージと障害メッセージは区別できません。

以下の手順とそれに関連したコード・フラグメントを 使用すると、Web サービス記述言語 (WSDL) 拡張を作成して、WSIF サービスが JMS 宛先の 基礎となるサービスにアクセスできるようにすることができます。

手順

例 1: JMS テキスト・メッセージ

JMS テキスト・メッセージには、java.lang.String が含まれています。この例では、WSDL メッセージにメッセージ本文全体の一部のみが含まれています。

<wsdl:definitions ... >

   <!-- simple or complex types for input and output message -->
   <wsdl:types> ... </wsdl:types>
   
   <wsdl:message name="JmsOperationRequest"> ... </wsdl:message>
   <wsdl:message name="JmsOperationResponse"> ... </wsdl:message>
 
   <wsdl:portType name="JmsPortType">
      <wsdl:operation name="JmsOperation">
         <wsdl:input name="Request" 
                     message="tns:JmsOperationRequest"/>
         <wsdl:output name="Response" 
                      message="tns:JmsOperationResponse"/>
      </wsdl:operation>
   </wsdl:portType>

   <wsdl:binding name="JmsBinding" type="JmsPortType">
      <jms:binding type="TextMessage" />

      <format:typemapping style="Java" encoding="Java">
         <format:typemap name="xsd:String" formatType="String" />
      </format:typemapping>

      <wsdl:operation name="JmsOperation">
         <wsdl:input message="JmsOperationRequest">
            <jms:input parts="requestMessageBody" />
         </wsdl:input>
         <wsdl:output message="JmsOperationResponse">
            <jms:output parts="responseMessageBody" />
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>

   <wsdl:service name="JmsService">
      <wsdl:port name="JmsPort" binding="JmsBinding">
         <jms:address destinationStyle="queue" 
                      jndiConnectionFactoryName="myQCF"
                      jndiDestinationName="myDestination"/>
      </wsdl:port>
   </wsdl:service>

</wsdl:definitions>

前述の JMS メッセージ例の拡張として、以下の WSDL の例は、要求/応答オペレーションを記述します。このオペレーションでは、要求および応答メッセージの特定の JMS プロパティー値が、要求メッセージに設定され、応答メッセージから取り出されます。

要求メッセージの JMS プロパティーは、入力メッセージの値に従って設定されます。 同様に、応答メッセージ用に選択された JMS プロパティーは、出力メッセージの対応する値にコピーされます。マッピングの方向は、 入力セクションまたは出力セクションの <jms:property> タグの 外観によって、それぞれ判別されます。

<wsdl:definitions ... >

   <!-- simple or complex types for input and output message -->
   <wsdl:types> ... </wsdl:types>
   
   <wsdl:message name="JmsOperationRequest"> 
      <wsdl:part name="myInt" type="xsd:int"/>
      ...
   </wsdl:message>

   <wsdl:message name="JmsOperationResponse"> 
      <wsdl:part name="myString" type="xsd:String"/>
      ... 
   </wsdl:message>
 
   <wsdl:portType name="JmsPortType">
      <wsdl:operation name="JmsOperation">
         <wsdl:input name="Request" 
                     message="tns:JmsOperationRequest"/>
         <wsdl:output name="Response" 
                      message="tns:JmsOperationResponse"/>
      </wsdl:operation>
   </wsdl:portType>

   <wsdl:binding name="JmsBinding" type="JmsPortType">
      <!-- the JMS message type might be any of the preceding types -->
      <jms:binding type="..." />

      <format:typemapping style="Java" encoding="Java">
         <format:typemap name="xsd:int" formatType="int" />
         ...
      </format:typemapping>

      <wsdl:operation name="JmsOperation">
         <wsdl:input message="JmsOperationRequest">
            <jms:property message="tns:JmsOperationRequest" parts="myInt" />
            <jms:propertyValue name="myLiteralString" 
                          type="xsd:string" value="Hello World" />
            ...
         </wsdl:input>
         <wsdl:output message="JmsOperationResponse">
            <jms:property message="tns:JmsOperationResponse" parts="myString" />
            ...
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>

   <wsdl:service name="JmsService">
      <wsdl:port name="JmsPort" binding="JmsBinding">
         <jms:address destinationStyle="queue" 
                      jndiConnectionFactoryName="myQCF"
                      jndiDestinationName="myDestination"/>
    </wsdl:port>
   </wsdl:service>

</wsdl:definitions>

トピックのタイプを示すアイコン タスク・トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=twsf_prnjwe
ファイル名:twsf_prnjwe.html