same problem as here
*** ServerHelloDone Warning: no suitable certificate found - continuing without client authentication *** Certificate chain <Empty> *** but the code is different
Connection conn = new Connection(); String data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:ns=\"SOME_URI\">" + "<soap:Header/><soap:Body>"+request.getParameter("data")+"</soap:Body></soap:Envelope>"; response.setContentType("text/xml; charset=\"UTF-8\""); String address = fias_address(); if (address != null && !address.equals("")) { try { conn.setURL(address); conn.createConnection(true); conn.sendDataFromString(data); byte[] b = new byte[1024]; int size; while ((size = conn.getDataStream().read(b)) != -1) response.getOutputStream().write(b, 0, size); conn.closeInputStream(); } catch (Exception e) { e.printStackTrace(); } in class Connection
public void createConnection(Boolean isSecure) { try { secure = isSecure; if (isSecure) { setSystemSecurityConnectionProperties(); con = (HttpsURLConnection) url.openConnection(); ((HttpsURLConnection) con).setRequestMethod("POST"); HostnameVerifier hv = new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { return fias.HostnameVerifier.DEFAULT.verify(hostname, session); } }; ((HttpsURLConnection) con).setHostnameVerifier(hv); } else con = (HttpURLConnection) url.openConnection(); } catch (IOException e) { e.printStackTrace(); } } public void sendDataFromString(String data) { OutputStream os = null; if (secure) con.setRequestProperty("Content-Type", "text/xml; charset=\"UTF-8\""); else con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=\"UTF-8\""); con.setRequestProperty("Content-Length", Integer.toString(data.length())); con.setDoOutput(true); con.setUseCaches(false); try { os = con.getOutputStream(); os.write(data.getBytes()); } catch (IOException e) { e.printStackTrace(); } finally { try { os.flush(); os.close(); } catch (IOException e) { e.printStackTrace(); } } raised a test server with a simple servlet for the answer and its own certificates - it connects normally, but on the remote server it does not connect to the SOAP server of someone else. there is no access to SOAP
for tests I use the form through which I send data to the servlet, it collects everything into a single string (XML) and sends it further to the SOAP server
when trying to establish a connection, the very first code with Warning cannot connect in the logs and the connection is closed on the server side
http-nio-8090-exec-1, handling exception: java.net.SocketException: Connection reset %% Invalidated: [Session-1, TLS_RSA_WITH_AES_128_CBC_SHA] %% Invalidated: [Session-2, TLS_RSA_WITH_AES_128_CBC_SHA] http-nio-8090-exec-1, SEND TLSv1 ALERT: fatal, description = unexpected_message http-nio-8090-exec-1, WRITE: TLSv1 Alert, length = 32 http-nio-8090-exec-1, Exception sending alert: java.net.SocketException: Connection reset by peer: socket write error http-nio-8090-exec-1, called closeSocket() http-nio-8090-exec-1, called close() http-nio-8090-exec-1, called closeInternal(true)