Liberty で Web サービスを実行している場合、HTTPS URL に指定されるホスト名はデフォルトで証明書を使用して検証されますが、WebSphere Application Server traditional ではそうではありません。ホスト名が無効である場合、Liberty サーバーは以下の例外をスローします。
java.io.IOException: The https URL hostname does not match
the Common Name (CN) on the server certificate in the client's truststore. Make sure the server certificate is correct, or to disable
this check (NOT recommended for production) set the CXF client TLS configuration property
disableCNCheck
to true.
この動作の違いは、javax.xml.ws パッケージによって提供される Java API for XML Web Services (JAX-WS) を使用するクライアント・アプリケーションに影響します。JAX-WS API が参照されると、プロジェクトには 1 回だけフラグが立てられます。
推奨される解決策は、正しいホスト名でサーバー証明書を作成することです。あるいは、ホスト名の検証を無効化する必要がある JAX-WS クライアントの http.conduit.tlsClientParameters.disableCNCheck プロパティーを設定することで、検証動作をカスタマイズできます。これを行うには、以下の例に示すように、server.xml ファイル内に <webservices-bnd> アプリケーション・バインディングを追加し、<service-ref> エレメントを使用してクライアント単位でプロパティーを設定します。
<enterpriseApplication id="SimpleEcho" name="SimpleEcho" location="SimpleEcho.ear">
<webservices-bnd moduleName="SimpleEcho">
<service-ref name="service/SimpleEchoService">
<port name="SimpleEchoPort">
<properties vendor="IBM"/>
</port>
<properties http.conduit.tlsClientParameters.disableCNCheck="true"/>
</service-ref>
</webservices-bnd>
</enterpriseApplication>
以下の例に示すとおり、ホスト名検証は、ibm-ws-bnd.xml ファイルの <service-ref> エレメントにプロパティーを追加することで無効にすることもできます。
<service-ref name="service/SimpleEchoService">
<port name="SimpleEchoPort">
<properties vendor="IBM"/>
</port>
<properties http.conduit.tlsClientParameters.disableCNCheck="true"/>
</service-ref>
Liberty 上の Web サービス・クライアントの Web サービス参照構成の構成について詳しくは、以下のリソースを参照してください。