웹 서비스 호스트 이름 유효성 검증 동작 차이

Liberty에서 웹 서비스를 실행하는 경우, 기본적으로 HTTPS URL에 제공되는 호스트 이름의 유효성이 인증서를 통해 검증되지만 WebSphere 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 패키지에서 제공하는 JAX-WS(Java API for XML Web Services)를 사용하는 클라이언트 애플리케이션에 영향을 미칩니다. JAX-WS API를 참조하는 경우 프로젝트는 한 번 플래그 지정됩니다.

권장되는 솔루션은 올바른 호스트 이름으로 서버 인증서를 작성하는 것입니다. 또는 호스트 이름 유효성 검증을 사용 안함으로 설정해야 하는 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에서 웹 서비스 클라이언트에 적합하게 웹 서비스 참조 구성을 구성하는 방법에 대해서는 다음을 참조하십시오.