Using SSL(Secure Socket Layer) in JAX-WS webservice

In this tutorial I will show how to use SSL/TSL or https in JAX-WS webservice. For using SSL with jax-ws webservice we need one keystore file. Please have a look at deploy jax-ws webservice before reading this tutorial.

First generate the keystore file using the below command from the command prompt. D:\keystore is the target location where the keystore file will be generated.

 

You will be prompted for below options. So put the values.

 

Configure Tomcat server to support for SSL

Open <tocat home directory>\conf\server.xml file and search for “<Connector port=”8443″ protocol=”HTTP/1.1″ SSLEnabled=”true” …/>”

Uncomment the above line and modify as shown below

 

For more information on SSL configuration you can have a look at the URL http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html

Now start the Tomcat Server and verify whether SSL connection gets established using https://localhost:8443/ in the browser.

Now test the service

 

You will get below exceptions in localhost so click on the below exception links to resolve the issues.

java.security.cert.CertificateException: No name matching localhost found
SunCertPathBuilderException: unable to find valid certification path to requested target

Thanks for your reading. Please leave a comment if you have any query.

Soumitra

Software Professional, I am passionate to work on web/enterprise application. For more information please go to about me. You can follow on Twitter. You can be a friend on Facebook or Google Plus or Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.