SOAP连接握手期间远程主机关闭连接

时间:2019-02-26 10:32:38

标签: java ssl curl

正在尝试连接到SOAP端点。

 public SOAPMessage getRequestObjectResponse(SOAPMessage message) {
    System.setProperty("https.protocols", "TLSv1");
    try {
        SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
        SOAPConnection soapConnection = soapConnectionFactory.createConnection();

        // Send SOAP Message to SOAP Server
        return soapConnection.call(message, config.getBaseUrl());
    } catch (SOAPException ex) {
        Logger.getLogger(SOAPWebServiceTemplate.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }
}

使用上面的代码,我不断在下面收到以下错误消息

  

at java.lang.Thread.run(未知来源)[na:1.8.0_191]   引起原因:com.sun.xml.messaging.saaj.SOAPExceptionImpl:消息发送失败           在com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:297)〜[saaj-impl-1.5.0.jar!/:na]           在com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:160)〜[saaj-impl-1.5.0.jar!/:na]           ...省略了59个通用框架   引起原因:javax.net.ssl.SSLHandshakeException:握手期间远程主机关闭了连接           在sun.security.ssl.SSLSocketImpl.readRecord(未知来源)〜[na:1.8.0_191]           在sun.security.ssl.SSLSocketImpl.performInitialHandshake(未知来源)〜[na:1.8.0_191]           在sun.security.ssl.SSLSocketImpl.startHandshake(未知来源)〜[na:1.8.0_191]           在sun.security.ssl.SSLSocketImpl.startHandshake(未知来源)〜[na:1.8.0_191]           在sun.net.www.protocol.https.HttpsClient.afterConnect(未知来源)〜[na:1.8.0_191]           在sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(未知来源)〜[na:1.8.0_191]           在sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(未知来源)〜[na:1.8.0_191]           在sun.net.www.protocol.http.HttpURLConnection.getOutputStream(未知源)〜[na:1.8.0_191]           在sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(未知来源)〜[na:1.8.0_191]           在com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:252)〜[saaj-impl-1.5.0.jar!/:na]           ...省略了60个通用框架   引起原因:java.io.EOFException:SSL对等项错误关闭           在sun.security.ssl.InputRecord.read(未知来源)〜[na:1.8.0_191]           ...省略了70个普通框架

我做了一个curl -v,并使用此website ssllabs

检查了网址的详细信息

下面的卷曲信息

* Expire in 0 ms for 6 (transfer 0x181648d20a0) * Expire in 1 ms for 1 (transfer 0x181648d20a0) * Expire in 2 ms for 1 (transfer 0x181648d20a0) * Expire in 2 ms for 1 (transfer 0x181648d20a0) * Expire in 3 ms for 1 (transfer 0x181648d20a0) * Expire in 3 ms for 1 (transfer 0x181648d20a0) * Expire in 5 ms for 1 (transfer 0x181648d20a0) * Trying some_ip ... * TCP_NODELAY set * Expire in 200 ms for 4 (transfer 0x181648d20a0) * Connected to url_not_disclosed (some_ip) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * successfully set certificate verify locations: * CAfile: C:\Users\Developer\Downloads\CURL\curl-7.64.0-win64-mingw\bin\curl-ca-bundle.crt CApath: none * TLSv1.3 (OUT), TLS handshake, Client hello (1): * OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to url_not_disclosed:443 * Closing connection 0 curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to url_not_disclosed:443

下面的平板详细信息

ssl labs TLS Protocol detail for url

1 个答案:

答案 0 :(得分:0)

因此,在Java 1.8中通常禁用SSL 3,而我要做的就是启用它。

  1. 转到您的JAVA_HOME目录,转到JAVA_HOME \ lib \ security \
  2. 使用任何文本编辑器打开java.security文件
  3. 在该文件中找到jdk.certpath.disabledAlgorithms并将其注释掉