Harbeer Kadian
Harbeer Kadian

Reputation: 394

Not able to access webservice using https protocol (ssl)

We had a webservice that is recently exposed over https.

When we try to connect to it over https using JAX-WS client, it throws following exception com.sun.xml.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection refused: connect Which generally means that the there is some problem over socket connection. It throws exception when we try to call some operation of webservice using webservice client. The http call to the webservice is working fine.

The funny thing here is that this problem only happens when we have deployed the webservice and had made our first call to access operations using https protocol. Now as soon as we make a http call, surprisingly after that even https also starts working.

Please give some advice if some one has faced this kind of issue before.

Upvotes: 0

Views: 565

Answers (1)

Shurok
Shurok

Reputation: 195

In general your java client should have ssl certificate in trusted key store.

Use keytool for certificate management: keytool -import -trustcacerts -keystore trastedCert -storepass traustedCertPassword -noprompt -alias trastedCert -file trastedCert.cer

Your can add trusted cert to your JVM(cacerts):

keytool -import -trustcacerts -keystore cacerts -storepass traustedCertPassword -noprompt -alias trastedCert -file trastedCert.cer

or

For jBoss app server I'm using next JAVA_OPTS params:

set JAVA_OPTS=%JAVA_OPTS% -Djavax.net.ssl.trustStore=%PATH_TO_CERT%\traustedCert -Djavax.net.ssl.trustStorePassword=traustedCertPassword

Upvotes: 1

Related Questions