Menu Close
22.2. 静的フェイルオーバーによる HA の有効化
概要
サービス WSDL ファイルでのレプリカ詳細のエンコード
サービス WSDL ファイルで、クラスター内のレプリカ詳細をエンコードする必要があります。例22.1「静的フェイルオーバーによる HA の有効化: WSDL ファイル」に、3 つのレプリカのサービスクラスターを定義する WSDL ファイルの抜粋を示します。
例22.1 静的フェイルオーバーによる HA の有効化: WSDL ファイル
<wsdl:service name="ClusteredService"> <wsdl:port binding="tns:Greeter_SOAPBinding" name="Replica1"> <soap:address location="http://localhost:9001/SoapContext/Replica1"/> </wsdl:port> <wsdl:port binding="tns:Greeter_SOAPBinding" name="Replica2"> <soap:address location="http://localhost:9002/SoapContext/Replica2"/> </wsdl:port> <wsdl:port binding="tns:Greeter_SOAPBinding" name="Replica3"> <soap:address location="http://localhost:9003/SoapContext/Replica3"/> </wsdl:port> </wsdl:service>
例22.1「静的フェイルオーバーによる HA の有効化: WSDL ファイル」に記載されている WSDL の抜粋は、以下のように記述できます。
3 つのポートで公開されるサービス ClusterService
を定義します。
-
Replica1
-
Replica2
-
Replica3
Replica1
を定義し、ClusterService
を SOAP over HTTP エンドポイントとしてポート 9001
で公開します。
Replica2
を定義し、ClusterService
を SOAP over HTTP エンドポイントとしてポート 9002
で公開します。
Replica3
を定義し、ClusterService
を SOAP over HTTP エンドポイントとしてポート 9003
で公開します。
クライアント設定へのクラスタリング機能の追加
例22.2「静的フェイルオーバーによる HA の有効化: クライアント設定」に示すように、クライアント設定ファイルにクラスタリング機能を追加します。
例22.2 静的フェイルオーバーによる HA の有効化: クライアント設定
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:clustering="http://cxf.apache.org/clustering" xsi:schemaLocation="http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <jaxws:client name="{http://apache.org/hello_world_soap_http}Replica1" createdFromAPI="true"> <jaxws:features> <clustering:failover/> </jaxws:features> </jaxws:client> <jaxws:client name="{http://apache.org/hello_world_soap_http}Replica2" createdFromAPI="true"> <jaxws:features> <clustering:failover/> </jaxws:features> </jaxws:client> <jaxws:client name="{http://apache.org/hello_world_soap_http}Replica3" createdFromAPI="true"> <jaxws:features> <clustering:failover/> </jaxws:features> </jaxws:client> </beans>