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