我想连接到网络服务,我正在使用ksoap2。我正在使用pfx cert文件。
这是代码:
KeyStore ks = KeyStore.getInstance("PKCS12");
ks.load(new FileInputStream("/pathToFile/cert.pfx"), "password".toCharArray());
KeyManagerFactory kmf = KeyManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
kmf.init(ks, "password".toCharArray());
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(kmf.getKeyManagers(), null, null);
HttpsTransportSE httpTransport = new HttpsTransportSE("10.10.8.221", 1246, "/WebService?singleWsdl", timeOut);
((HttpsServiceConnectionSE) httpTransport.getServiceConnection()).setSSLSocketFactory(sslContext.getSocketFactory());
当我跑步时
httpTransport.call("...
我收到以下错误:
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
有任何建议吗?