wsdl-firstのデプロイと実行
次に、チュートリアルを参考に、単純なWEBサービスを稼働させるサンプルを実行。
JBIコンテナにデプロイする単位は、SA:ServiceAssembly(直訳すると『サービス集合』)というらしい。JavaWEBアプリで言うところの、WARと同じものらしい。
ひとまず、以下のファイルを、
C:\apache-servicemix-3.3\examples\wsdl-first\wsdl-first-sa-3.3.zip
ど〜んと、以下のホットデプロイディレクトリにコピーする。
C:\apache-servicemix-3.3\hotdeploy
それで、自動的にデプロイが始まる。作業はこれだけ。
稼働確認のために、
C:\apache-servicemix-3.3\examples\wsdl-first\client.html
を、開いてみる。この時、IEだと正常に稼働してくれない。FireFoxがオススメ。
「send」ボタンを押して、以下画像のように右側のボックスに結果が出力されればOK。
さて、ServiceAssemblyの中身を見ていきましょう。
ホットデプロイディレクトリにコピーしたZIPファイルを解凍。この中で3つのファイルが、ServiceAssemblyのために絶対に必要なファイル。
(1)JBI展開記述子(META-INF/jbi.xml)
中身を見てみると。
<?xml version="1.0" encoding="UTF-8"?> <jbi xmlns="http://java.sun.com/xml/ns/jbi" version="1.0"> <service-assembly> <identification> <name>wsdl-first-sa</name> <description>ServiceMix :: Samples :: WSDL first :: SA</description> </identification> <service-unit> <identification> <name>wsdl-first-jsr181-su</name> <description>ServiceMix is an open source ESB based on the Java Business Integration framework - JSR-208</description> </identification> <target> <artifacts-zip>wsdl-first-jsr181-su-3.3.zip</artifacts-zip> <component-name>servicemix-jsr181</component-name> </target> </service-unit> <service-unit> <identification> <name>wsdl-first-http-su</name> <description>ServiceMix is an open source ESB based on the Java Business Integration framework - JSR-208</description> </identification> <target> <artifacts-zip>wsdl-first-http-su-3.3.zip</artifacts-zip> <component-name>servicemix-http</component-name> </target> </service-unit> </service-assembly> </jbi>
これを見ると、二つのServiceUnitで構成されていることが分かる。
ひとつは、wsdl-first-jsr181-su という名前のServiceUnit。これは、wsdl-first-jsr181-su-3.3.zipというZIPファイルが本体だということが分かる。このファイルは、ServiceAssemblyのZIPの中の直下に存在する。
<service-unit> <identification> <name>wsdl-first-jsr181-su</name> <description>ServiceMix is an open source ESB based on the Java Business Integration framework - JSR-208</description> </identification> <target> <artifacts-zip>wsdl-first-jsr181-su-3.3.zip</artifacts-zip> <component-name>servicemix-jsr181</component-name> </target> </service-unit>
二つ目は、wsdl-first-http-su というServiceUnit。wsdl-first-http-su-3.3.zipというZipファイルが本体で、やはりSeriviceAssemblyのZIPの直下に存在する。
<service-unit> <identification> <name>wsdl-first-http-su</name> <description>ServiceMix is an open source ESB based on the Java Business Integration framework - JSR-208</description> </identification> <target> <artifacts-zip>wsdl-first-http-su-3.3.zip</artifacts-zip> <component-name>servicemix-http</component-name> </target> </service-unit>
ここで、JSR-181やら、JSR-208とあるのは、単純なプログラムをWEBサービスとして公開するための規約のようなものらしい。JSR-181に従ってるんで、それでWEBサービス化しちゃっていいですよ、と宣言している状態で、これによって各製品はプログラムをWEBサービスとして公開してくれるみたい。
JSR-181の参考サイト
Java Web サービスのデプロイ
JSR-181 第三章の勉強 - 酒気帯びプログラミング
JSR-181とJAX-WS - 開発メモ - livedoor Wiki(ウィキ)
JSR-208は、JBIの仕様を指す。
JSR208: Java Business Integration (JBI) - 昼間のメモ
つまり、二つのServiceUnitのうち、wsdl-first-jsr181-suはJBIとして定義されているServiceUnitで、wsdl-first-http-suはそれをHttpで公開するためのServiceUnitということになる。
次からは、これらのServiceUnitや、ServiceAssemblyをどう作るのかを見ていく。