Access Keys:
Skip to content (Access Key - 0)

WSDLトランスポート・プロバイダは、リモートWeb Serviceを起動するためにWSDLを取得します。ESB Muleはサービスのダイナミック・プロクシを作成して、起動します。

このプロバイダのJavadocはここにあります。

WSDLコネクタのプロパティ

WSDLコネクタはスーパークラスのプロパティを全て継承します。スーパークラスはXFireConnector 又はAxisConnectorです。

WSDLエンドポイント

WSDLエンポイントはAxis, Glue, XFireのような他SOAPエンドポイントと類似した仕組みです。起動するサービスのWSDLへの完全URLを指定して、ESB Muleが起動するサービスを「メソッド」パラメータを指定します。

wsdl:http://www.webservicex.net/stockquote.asmx?WSDL&method=GetQuote

WSDL URLに接頭辞wsdl:を付けます。ESB MuleはWSDLからクライアント・プロキシーを作成するWSDLプロバイダがクラス・パスあるか確認をします。ESB MuleはAxisとXFireメソッドに対応しています。指定する場合は以下のように接頭辞で指定します。

wsdl-xfire:http://www.webservicex.net/stockquote.asmx?WSDL&method=GetQuote
又は、
wsdl-axis:http://www.webservicex.net/stockquote.asmx?WSDL&method=GetQuote

XFire WSDLディスパッチャーのJavadocはここにあります。

AxisWSDLディスパッチャーのJavadocはここにあります。

Issue with Axis

ために、Axis WSDL生成はただしく動作しません(間違った名前空間が使われる)。その場合はXFire WSDLを利用してください。今のところは問題はありません。

トランスフォーマー

WSDLエンドポイントには特定したトランスフォーマーはありません。

別のWSDLを指定する場合

XFireトランスポートを利用する場合は、?WSDLパラメータを使って指定されたWSDLのアドレスと異なるアドレスを指定することができます。この方法は、SOAPエンジンが提供しない場合や、プロバイダがWSDLを公開したくない場合のように、WSDLを通常のように指定することができない場合に使うことができます。

この場合は、XFireエンドポイントの「wsdlUrl」プロパティを以下のように指定することができます:

<endpoint
  address="wsdl-xfire:http://localhost:8080/book/services/BookService?method=getBooks"
  connector="xfiretest">
 <properties>
  <property name="wsdlUrl" value="file:///c:/BookService.xml"/>
 </properties>
</endpoint>

この場合は、wsdl-xfireエンドポイントはローカル・ディスクからWSDLを読込む他は通常のように動作します。

XFire WSDLエンドポイントの例

以下の手順は、XFire WSDLエンドポイントを利用する簡単な例です。

  1. 最新版のXFireをダウンロードする(現在は1.2.5)
  2. XFireユーザ・ガイドを基に、例題「book」のWARをビルドする。
  3. WARをサブレット・コンテナにディプロイして、起動する。
  4. WAR(WEB-INF/classes下)からXFireデモ・クラスをJarして、作成したjarファイルをESB Muleクラスパスに設定する。
  5. 以下のESB Mule設定ファイルを利用してサービスを利用する(URLは実行環境用に変更してください)。
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE mule-configuration PUBLIC "-//MuleSource //DTD mule-configuration XML V1.0//EN"
                     "http://mule.mulesource.org/dtds/mule-configuration.dtd">

<!-- 以下の例題XFire bookを使って、XFireサービスを起動します -->
<mule-configuration id="Sample" version="1.0">

 <mule-environment-properties synchronous="true"/>

 <!-- 送信メッセージに正しいSOAPヘッダを追加するのに必要 -->
 <connector name="xfiretest" className="org.mule.providers.soap.xfire.wsdl.XFireWsdlConnector">
  <properties>
   <property name="clientTransport" value="org.codehaus.xfire.transport.http.SoapHttpTransport"/>
   <list name="clientOutHandlers">
    <entry value="org.codehaus.xfire.demo.handlers.OutHeaderHandler"/>
   </list>
  </properties>
 </connector>

 <transformers>
  <transformer name="DomDocumentToXml" className="org.mule.transformers.xml.DomDocumentToXml"/>
 </transformers>

 <model name="sample">

  <mule-descriptor name="inputService"
   implementation="org.mule.components.simple.PassThroughComponent">

   <inbound-router>
    <endpoint address="stream://System.in?promptMessage=Enter something to invoke the service:"/>
   </inbound-router>

   <outbound-router>
    <router className="org.mule.routing.outbound.ChainingRouter">
     <endpoint address="wsdl-xfire:http://127.0.0.1:8080/xfiretest/services/BookService?method=getBooks"
               connector="xfiretest"/>
     <endpoint address="vm://process"/>
    </router>
   </outbound-router>

  </mule-descriptor>

  <mule-descriptor name="outputService"
   implementation="org.mule.components.simple.PassThroughComponent">

   <inbound-router>
    <endpoint address="vm://process"/>
   </inbound-router>

   <outbound-router>
    <router className="org.mule.routing.outbound.OutboundPassThroughRouter">
     <endpoint address="stream://System.out?transformers=DomDocumentToXml"/>
    </router>
   </outbound-router>

  </mule-descriptor>

 </model>
</mule-configuration>

複数の引数があるXFire WSDLエンドポイントの例

外部SOAPサービスに複数の引数を渡す場合があります。例えばwww.webservicex.netのCurrency Convertor(為替の交換)には2つの引数を指定します:元の為替コードと変換後の為替コード。

XFireディスパッチーがサービスを起動するために引数を用意する場合は、Object[]型(Object配列)のメッセージ・ペイロードを期待します。Currency Convertorの例では、2つのObjectがある配列になります。

複数の方法がありますが、一番簡単な方法は区切られたStringをObject配列に変換するトランスフォーマーStringToObjectArrayTransformerを使うことです。以下の例では、<fromCurrency>,<toCurrency>形式でStringを入力するだけでObject配列に変換されます。

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE mule-configuration PUBLIC "-//MuleSource //DTD mule-configuration XML
V1.0//EN" "http://mule.mulesource.org/dtds/mule-configuration.dtd">

<!-- 為替変換サービスを使ってみる -->
<mule-configuration id="Sample" version="1.0">

 <mule-environment-properties synchronous="true"/>

 <transformers>
  <transformer name="StringToObjectArray" className="org.mule.transformers.simple.StringToObjectArray">
   <properties>
    <property name="delimiter" value=","/>
   </properties>
  </transformer>
 </transformers>

 <model name="sample">

  <mule-descriptor name="inputService"
   implementation="org.mule.components.simple.PassThroughComponent">

   <inbound-router>
    <endpoint address="stream://System.in?promptMessage=Enter from and to currency symbols, separated by a comma:"
                    transformers="StringToObjectArray"/>
   </inbound-router>

   <outbound-router>
    <router className="org.mule.routing.outbound.ChainingRouter">
     <endpoint address="wsdl-xfire:http://www.webservicex.net/CurrencyConvertor.asmx?WSDL&amp;method=ConversionRate"/>
     <endpoint address="stream://System.out"/>
    </router>
   </outbound-router>

  </mule-descriptor>

 </model>
</mule-configuration>

例えば、ユロからUSドルの為替レートを取得するために「EUR,USD」と入力しますと、以下のような結果が表示されます:

Enter from and to currency symbols, separated by a comma:
EUR,USD
1.3606
Adaptavist Theme Builder (3.3.2-conf2.10) Powered by Atlassian Confluence 2.10, the Enterprise Wiki.
Free theme builder license