我已经用证书创建了一个信任库,并用私钥创建了密钥库。我放入了以下代码,加载了trsustore管理器和keystore管理器,然后创建了SSL上下文的实例。
当我向webservice发出请求时,就会调用下面的代码。我们使用的是axis2接口。
SSLContext context = SSLContext.getInstance(protocolVersion);
context.init(keyManagers, trustManagers, null);
SSLSocketFactory socketFactory = context.getSocketFactory();
SslContextedSecureProtocolSocketFactory secureProtocolSocketFactory = new SslContextedSecureProtocolSocketFactory(context);
Protocol authhttps = new Protocol("https", secureProtocolSocketFactory, port);
HttpClient httpclient = new HttpClient();
httpclient.getHostConfiguration().setHost(hostname, port, authhttps);
GetMethod httpget = new GetMethod("/RTAPService/RTAPService");也尝试了新的httpget = GetMethod GetMethod("/");
httpclient.executeMethod(httpget);它给我下面的错误..
org.apache.axis2.AxisFault: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target其中主机名为"qartap.csnet.assurity.sg“,我的URL服务URL为"https://qartap.csnet.assurity.sg:8443/RTAPService/RTAPService”
问题是当我注册我的"HTTPS“协议时,它会影响我的整个应用程序,我能以某种方式为特定的主机或特定的when服务设置这些协议吗?
我想使用主机名或创建新协议本身来设置它……我尝试了解决方案here中给出的方法。但它给了我以下例外..
在将with服务URl传递给生成的存根构造函数时,我将url中的"HTTPS“替换为我自己定制的"myHTTPS”。
The system cannot infer the transport information from the myhttps://serverUrl:7001/app/services/RTAPDevService.RTAPDevServiceHttpSoap12Endpoint/ URL.发布于 2014-06-27 19:28:15
通过将证书添加到cacerts文件并将其指向weblogic,解决了同样的问题。最初,证书链未正确导入cacerts文件。此外,还有一些关于证书导入的问题。
下面的链接可以参考
http://ankursinghal86.blogspot.in/2014/06/authentication-with-client-certificate.html
https://stackoverflow.com/questions/10053898
复制相似问题