0

HTTPS を使用する必要がある JBoss AS7.1 に WebService をデプロイしました。この方法でサーバー上にstandalone.xmlを構成しました:

  <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
        <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" redirect-port="8443"/>
        <connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
            <ssl name="server-ssl" key-alias="server" password="secret" certificate-key-file="../standalone/configuration/server.keystore" protocol="TLSv1" verify-client="false"/>
        </connector>
        <virtual-server name="default-host" enable-welcome-root="true">
            <alias name="localhost"/>
            <alias name="example.com"/>
        </virtual-server>
    </subsystem>

<socket-binding name="http" port="8080"/>
<socket-binding name="https" port="8443"/>

キーストアは正しい位置にあり、 web.xml に追加しました:

<security-constraint>
     <web-resource-collection>
         <web-resource-name>HTTPS Test</web-resource-name>
         <url-pattern>/*</url-pattern>
     </web-resource-collection>
     <user-data-constraint>
         <transport-guarantee>CONFIDENTIAL</transport-guarantee>
     </user-data-constraint>
</security-constraint>

WebService は動作しており、HTTPS を使用しています。実際、Web ブラウザーから URL にアクセスすることで確認できます。

私の問題は、別の JBoss AS 7.1 にデプロイされ、動作しないクライアントです。wsdl からクライアントを作成し、https を使用するようにクラス WebServicesService の最初の部分を変更しました。

@WebServiceClient(name = "WebServicesService", 
wsdlLocation = "https://192.168.1.104:8443/Server/WebServices?wsdl",
targetNamespace = "http://webservices.foo.it/") 
@HandlerChain(file="to-server-handler-chain.xml")

public class WebServicesService extends Service {

public final static URL WSDL_LOCATION;

public final static QName SERVICE = new QName("http://webservices.foo.it/", "WebServicesService");
public final static QName WebServicesPort = new QName("http://webservices.foo.it/", "WebServicesPort");
static {
    URL url = null;
    try {
        url = new URL("https://192.168.1.104:8443/Server/WebServices?wsdl");
    } catch (MalformedURLException e) {
        java.util.logging.Logger.getLogger(WebServicesService.class.getName())
        .log(java.util.logging.Level.INFO, 
                "Can not initialize the default wsdl from {0}", "file");
    }
    WSDL_LOCATION = url;
}

public WebServicesService(URL wsdlLocation) {

    super(wsdlLocation, SERVICE);
}


public WebServicesService(URL wsdlLocation, QName serviceName) {
    super(wsdlLocation, serviceName);
}

public WebServicesService() {
    super(WSDL_LOCATION, SERVICE);
}

//This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
//API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
//compliant code instead.
public WebServicesService(WebServiceFeature ... features) {
    super(WSDL_LOCATION, SERVICE, features);
}

//This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
//API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
//compliant code instead.
public WebServicesService(URL wsdlLocation, WebServiceFeature ... features) {
    super(wsdlLocation, SERVICE, features);
}

//This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
//API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
//compliant code instead.
public WebServicesService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {
    super(wsdlLocation, serviceName, features);
}

/**
 *
 * @return
 *     returns WebServices
 */
@WebEndpoint(name = "WebServicesPort")
public WebServices getWebServicesPort() {
    return super.getPort(WebServicesPort, WebServices.class);
}

/**
 * 
 * @param features
 *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
 * @return
 *     returns WebServices
 */
@WebEndpoint(name = "WebServicesPort")
public WebServices getWebServicesPort(WebServiceFeature... features) {
    return super.getPort(WebServicesPort, WebServices.class, features);
}

}

最初の接続を試みると、クライアント JBoss は次のように出力します。

[org.jboss.wsf.stack.cxf.resolver.JBossWSResourceResolver] (http--192.168.1.102-8080-1) Cannot open stream for resource: https://192.168.1.104:8433/Server/WebServices?wsdl

そして例外:

[org.jboss.ws.common.invocation.InvocationHandlerJAXWS] (http--192.168.1.102-8080-1) Method invocation failed with exception: null: java.lang.reflect.InvocationTargetException
Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'https://192.168.1.104:8443/Server/WebServices?wsdl'.: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

クライアントが HTTPS を使用してサーバーに接続できない原因は何ですか?

4

0 に答える 0