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 をポート 9001 で SOAP over HTTP エンドポイントとして公開します。
Replica2 を定義して、ClusterService をポート 9002 で SOAP over HTTP エンドポイントとして公開します。
Replica3 を定義して、ClusterService をポート 9003 で SOAP over HTTP エンドポイントとして公開します。
クラスターリング機能をクライアント設定に追加します
クライアント設定ファイルに、例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>