我正在使用org.apache.commons.httpclient.HttpClient
3.1调用SOAP服务器。这是我的代码片段:
URL targetURL =
new URL(msgContext.getStrProp(MessageContext.TRANS_URL));
HttpClient httpClient = new HttpClient(this.connectionManager);
httpClient.getParams().setConnectionManagerTimeout(this.clientProperties.getConnectionPoolTimeout());
HostConfiguration hostConfiguration =
getHostConfiguration(httpClient, msgContext, targetURL);
Credentials defaultcreds = new UsernamePasswordCredentials(msgContext.getUsername(), msgContext.getPassword());
httpClient.getState().setCredentials(new AuthScope(msgContext.getStrProp(MessageContext.TRANS_URL), 80, AuthScope.ANY_REALM), defaultcreds);
httpClient.getParams().setAuthenticationPreemptive(true);
httpClient.executeMethod(hostConfiguration, method, null);
但是我得到javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
例外。
我试图通过创建一个不验证证书的信任管理器来修复它。但错误仍然存在。 有没有其他方法可以使用TLSv1.2或by-pass ssl security来调用它?