Apache CXF通过TLS

时间:2012-06-20 15:45:18

标签: cxf

2012年6月21日更新 一点点更新。今天我终于发现了阻止我连接到服务器的异常。这是我在致电getInputStream()后得到的:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

=============================================== ============

原始邮件:

我正在尝试使我的客户端(客户端不是完全由我编写)与TLS上发布的Web服务一起工作(客户端通过http工作)。我是这个领域的新手,我以前从未使用过Web服务。我已经用soapUI检查了Web服务是否正确发布和可访问。地址为 https://:9080 / SOAOICCT / services / SessionService?wsdl 。我可以发送请求并收到回复。但我的客户抛出了很多例外。这是最重要的:

javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
    at <My class.my method>(SessionServiceDAO.java:548)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
......
Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
    at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:150)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:65)
    at javax.xml.ws.Service.<init>(Service.java:56)
.........
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: java.lang.IllegalArgumentException: InputSource must have a ByteStream or CharacterStream
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:226)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:179)
    at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:91)
    ... 70 more
Caused by: java.lang.IllegalArgumentException: InputSource must have a ByteStream or CharacterStream
    at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:983)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:217)
    ... 72 more

我已将此问题跟踪到方法java.net.HttpURLConnection.getResponseCode()。 这是:

public int getResponseCode() throws IOException {
    /*
     * We're got the response code already
     */
    if (responseCode != -1) {
        return responseCode;
    }

    /*
     * Ensure that we have connected to the server. Record
     * exception as we need to re-throw it if there isn't
     * a status line.
     */
    Exception exc = null;
    try {
            getInputStream();
    } catch (Exception e) {
        exc = e;
    }

我在getInputStream()收到异常,但实际上从未连接到服务器。稍后会在此org.apache.cxf.transport.TransportURIResolver.resolve(String, String)

中吞下此异常
} catch (Exception e) {
                //ignore
            } 

问题似乎非常简单,如身份验证或参数。有什么明显的原因导致我无法连接到Web服务吗?我是一个新手,我甚至可以犯一个非常简单的错误。

这是我的http:conduit

<http:conduit name="*.http-conduit">
      <http:tlsClientParameters secureSocketProtocol="TLS">
            <sec:trustManagers>
                <sec:keyStore type="JKS" password="123123" file="config.soa.client/trustedCA.keystore"/>
            </sec:trustManagers>

            <sec:cipherSuitesFilter>
                <sec:include>SSL_RSA_WITH_RC4_128_MD5</sec:include>
                <sec:include>SSL_RSA_WITH_RC4 _128_SHA</sec:include>
                <sec:include>SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA</sec:include>
                <sec:include>.*_EXPORT_.*</sec:include>
                <sec:include>.*_EXPORT1024_.*</sec:include>
                <sec:include>.*_WITH_DES_.*</sec:include>
                <sec:include>.*_WITH_NULL_.*</sec:include>
                <sec:exclude>.*_DH_anon_.*</sec:exclude>
            </sec:cipherSuitesFilter>
        </http:tlsClientParameters>
    </http:conduit>

稍微更新一下。今天我终于发现了阻止我连接到服务器的异常。这是我在致电getInputStream()后得到的:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

0 个答案:

没有答案