BPEL プロセス用ヘルパー・クラスの作成 (.NET)

特定の Web サービス API 操作では、クライアント・アプリケーションが 「document/literal」スタイルのラップ・エレメントを使用する必要があります。クライアント・アプリケーションは、 ヘルパー・クラスに、必要なラッパー・エレメントの生成を担当させます。

始める前に

ヘルパー・クラスを作成するには、Web サービス API の WSDL ファイルを、WebSphere® Process Server 環境からエクスポートしておく必要があります。

このタスクを実行する理由と実行時期

Web サービス API の call() 命令と sendMessage() 命令により 、BPEL プロセスが WebSphere Process Server 内で起動します。call() 命令の入力メッセージは 、BPEL プロセスの入力メッセージの document/literal ラッパーが提供されると予想します。 BPEL プロセスに必要な Bean およびクラスを生成するには 、<wsdl:types> エレメントを新規 XSD ファイルにコピーしてから、xsd.exe ツールを使用してヘルパー・クラスを生成します。

このタスクのステップ

  1. BPEL プロセス・インターフェースの WSDL ファイルをまだ WebSphere Integration Developer からエクスポートしていない場合は、ここでエクスポートします。
  2. テキスト・エディターまたは XML エディターで WSDL ファイルを開きます。
  3. <wsdl:types> エレメントのすべての子エレメントの内容をコピーし、 新しいスケルトン XSD ファイルに貼り付けます。
  4. XSD ファイル上で xsd.exe ツールを実行します。

    call xsd.exe file.xsd /classes /o

    各部の意味は、次のとおりです。

    file.xsd
    変換する XML スキーマ定義ファイル。
    /classes (/c)
    指定した XSD ファイル (複数も可) の内容に対応する ヘルパー・クラスを生成します。
    /output (/o)
    生成したファイルの出力ディレクトリーを指定します。このディレクトリーを省略した場合、 デフォルトは現行ディレクトリーです。

    以下に例を示します。

    call xsd.exe ProcessCustomer.xsd /classes /output:c:¥temp

  5. 生成されるクラス・ファイルをクライアント・アプリケーションに追加します。 例えば Visual Studio を使用する場合は、 「プロジェクト」 > 「既存項目の 追加 (Add Existing Item)」メニュー・オプションを実行します。

ProcessCustomer.wsdl ファイルの内容が 以下のような場合:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:bons1="http://com/ibm/bpe/unittest/sca" 
                  xmlns:tns="http://ProcessTypes/bpel/ProcessCustomer" 
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                  name="ProcessCustomer" 
                  targetNamespace="http://ProcessTypes/bpel/ProcessCustomer">
  <wsdl:types>
    <xsd:schema targetNamespace="http://ProcessTypes/bpel/ProcessCustomer" 
                xmlns:bons1="http://com/ibm/bpe/unittest/sca" 
                xmlns:tns="http://ProcessTypes/bpel/ProcessCustomer" 
                xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:import namespace="http://com/ibm/bpe/unittest/sca" 
                schemaLocation="xsd-includes/http.com.ibm.bpe.unittest.sca.xsd"/>
      <xsd:element name="doit">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="input1" nillable="true" type="bons1:Customer"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="doitResponse">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="output1" nillable="true" type="bons1:Customer"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
  </wsdl:types>
    <wsdl:message name="doitRequestMsg">
    <wsdl:part element="tns:doit" name="doitParameters"/>
  </wsdl:message>
    <wsdl:message name="doitResponseMsg">
    <wsdl:part element="tns:doitResponse" name="doitResult"/>
  </wsdl:message>
    <wsdl:portType name="ProcessCustomer">
    <wsdl:operation name="doit">
      <wsdl:input message="tns:doitRequestMsg" name="doitRequest"/>
      <wsdl:output message="tns:doitResponseMsg" name="doitResponse"/>
    </wsdl:operation>
  </wsdl:portType>
</wsdl:definitions>
結果として出力される XSD ファイルは以下のようになります。
<xsd:schema xmlns:bons1="http://com/ibm/bpe/unittest/sca" 
                      xmlns:tns="http://ProcessTypes/bpel/ProcessCustomer" 
                      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                      targetNamespace="http://ProcessTypes/bpel/ProcessCustomer">
<xsd:import namespace="http://com/ibm/bpe/unittest/sca" 
              schemaLocation="Customer.xsd"/>
<xsd:element name="doit">
<xsd:complexType>
<xsd:sequence>
				<xsd:element name="input1" type="bons1:Customer" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="doitResponse">
<xsd:complexType>
<xsd:sequence>
				<xsd:element name="output1" type="bons1:Customer" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
関連タスク
ビジネス・オブジェクトのエクスポート
関連情報
XML スキーマ定義ツール (XSD.EXE) の Microsoft 文書

(c) Copyright IBM Corporation 2005, 2006. All rights reserved.
(c) Copyright IBM Japan 2006
このインフォメーション・センターでは、Eclipse テクノロジー (http://www.eclipse.org) が採用されています。