2 Replies Latest reply on Jul 25, 2017 2:48 PM by leor amikam

    jax-ws client https not working

    leor amikam Newbie

      jboss 7 eap standalone mode.  Generated a jax-ws client to connect to external web service.    It is using https with an url of https://smartpayform.com/api/transaction/transaction.asmx

       

      I have exported the site certificate and inserted into a keystore I create.  I could not find enough detail on how to configure jboss directly (in standalone.xml or cli), so I

      found some java code to add the certificate to the jax-ws client:

       

                  SSLContext sc = SSLContext.getInstance("TLS");

                  KeyManagerFactory kmf =    KeyManagerFactory.getInstance( KeyManagerFactory.getDefaultAlgorithm() );

                  KeyStore ks = KeyStore.getInstance( KeyStore.getDefaultType() );

                  ks.load(new FileInputStream( "C:\\Users\\amikaml\\.keystore" ), certPassword.toCharArray() );

                  kmf.init( ks, certPassword.toCharArray() );

                  sc.init( kmf.getKeyManagers(), null, null );

                   binding.getRequestContext().put("com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory",sc.getSocketFactory() )

       

      When I execute, getting the error below.  If I try to access the web service outside EAP with a plain old, stadalone java app, it works fine.

       

      09:45:57,345 INFO  [stdout] (default task-6) Caused by: java.net.SocketException: Unrecognized Windows Sockets error: 0: recv failed

      09:45:57,345 INFO  [stdout] (default task-6) at java.net.SocketInputStream.socketRead0(Native Method) ~[?:1.8.0_111]

      09:45:57,345 INFO  [stdout] (default task-6) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[?:1.8.0_111]

      09:45:57,345 INFO  [stdout] (default task-6) at java.net.SocketInputStream.read(SocketInputStream.java:170) ~[?:1.8.0_111]

      09:45:57,345 INFO  [stdout] (default task-6) at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[?:1.8.0_111]

      09:45:57,345 INFO  [stdout] (default task-6) at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) ~[?:?]

      09:45:57,345 INFO  [stdout] (default task-6) at sun.security.ssl.InputRecord.read(InputRecord.java:503) ~[?:?]

      09:45:57,345 INFO  [stdout] (default task-6) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) ~[?:?]

      09:45:57,345 INFO  [stdout] (default task-6) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) ~[?:?]

      09:45:57,345 INFO  [stdout] (default task-6) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) ~[?:?]

      09:45:57,345 INFO  [stdout] (default task-6) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) ~[?:?]

      09:45:57,345 INFO  [stdout] (default task-6) at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559) ~[?:?]

       

      Some more details.  I ran wireshark.  The 1st three rows show the jboss connection attempt.  It is incorrectly trying to use SSL.

      THe second three lines are the same web service call through sopaui, and it is using TLS correctly.  How do I get jboss to use the correct handshake?

      p.png