利用するWebサービスを検索する手段、および決定したWebサービスを導入するための方法について説明します。
Webサービスのディレクトリサービス
運用管理者は、必要な要件を満足するWeb サービスを探し出し、WS USPの設定に必要な情報を入手する必要があります。
インターネット上には、 Webサービスを検索するためのディレクトリサービスとして、以下が提供されています。代表的なディレクトリサービスはUDDIです。
UDDI
http://www.uddi.org/
XMethods
http://www.xmethods.com/
日本では、WebService.jp(http://www.webservice.jp)が試験的に辞書引きのWebサービスを提供しています。
WS USPに必要な情報
WebサービスをWS USPとして利用するには、以下の情報を入手する必要があります。
情報 | 備考 |
|---|---|
WSDL の URL | 必須です。 |
WebサービスサーバのURL(AccessPoint) | WSDLにservice要素が指定されている場合は不要です。 |
なお、以下のWebサービスは、WS USPとして利用できません。
HTTP以外のプロトコル
SOAPバインディング以外のバインディング
Webサービスの例
以降の説明では、以下のようなWSDLで記述されるWebサービス(以降、「翻訳Webサービス」と呼びます)を例として説明します。
|
翻訳WebサービスのWSDLの内容は次のようになっています。
(※WSDLのURLは、「http://www.xmethods.net/sd/2001/BabelFishService.wsdl」とします。)
<?xml version="1.0"?>
<definitions name="BabelFishService"
xmlns:tns=http://www.xmethods.net/sd/BabelFishService.wsdl
targetNamespace=http://www.xmethods.net/sd/BabelFishService.wsdl
xmlns:xsd=http://www.w3.org/2001/XMLSchema
xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/
xmlns="http://schemas.xmlsoap.org/wsdl/">
<message name="BabelFishRequest">
<part name="translationmode" type="xsd:string"/>
<part name="sourcedata" type="xsd:string"/>
</message>
<message name="BabelFishResponse">
<part name="return" type="xsd:string"/>
</message>
<portType name="BabelFishPortType">
<operation name="BabelFish">
<input message="tns:BabelFishRequest" />
<output message="tns:BabelFishResponse" />
</operation>
</portType>
<binding name="BabelFishBinding" type="tns:BabelFishPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="BabelFish">
<soap:operation soapAction="urn:xmethodsBabelFish#BabelFish"/>
<input>
<soap:body use="encoded" namespace="urn:xmethodsBabelFish"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:xmethodsBabelFish"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="BabelFishService">
<documentation>Translates text of up to 5k in length, between a variety of languages.
</documentation>
<port name="BabelFishPort" binding="tns:BabelFishBinding">
<soap:address location="http://services.xmethods.net:80/perl/soaplite.cgi"/>
</port>
</service>
</definitions>上記のように、WSDLの内容は複雑ですが、 “4.4.2 Webサービスの導入(WS USPの別名作成)”に示すWS USPの別名機能を利用すれば、WSDLの詳細を理解しなくてもWebサービスを利用することができます。