我想通过https调用web服务,并且我需要包括客户端证书。我正在对SAAJ做这件事
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
conn = soapConnectionFactory.createConnection();
URL endpoint = new URL(urlEndPoint);
SOAPMessage response = conn.call(msg, endpoint);但是如何包含客户端证书呢?
发布于 2014-06-10 13:49:32
我创造
KeyManagerFactory kmf = csm.getKeyManagerFactory();
TrustManagerFactory tmf = csm.getTrustManagerFactory();
SSLContext sslcontext = SSLContexts.custom().useProtocol("SSL").build();
sslcontext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), new SecureRandom());然后I setDefaultSSLSocketFactory
HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory());https://stackoverflow.com/questions/24115156
复制相似问题