JAX WS HTTPS Hello World using Eclipse and Tomcat

In this article, we will create a soap service for HTTPS and deploy it on Tomcat.

We will first need to setup Tomcat for HTTPS. Please refer the below link for the setup:

Tomcat setup for HTTPS

Now lets create a webservice with User/Roles security.

Step 1:

Create a Dynamic Web Project using Eclipse and name it JAXWSWeb.

Step 2:

Create a package com.techkatak and create a @WebService Hello in it.

Step 3:

Add below web.xml file under WEB-INF.

Step 4:

Add sun-jaxws.xml file under WEB-INF.

Step 5:

Download metro jars and add them to the project.

The classes WSServletContextListener and WSServlet are present in jar file webservices-rt.jar

This jar along with other jars can be downloaded from Metro project( added in your project.

Copy the jar files webservices-rt.jar and webservices-api.jar into your project src folder and deploy your code on the Tomcat Server. (You can also use an Ant script for this as mentioned in Metro project website)

Here is how the project structure looks like:


Step 6:

Export the project as WAR file to webapps folder under Tomcat installation directory.


Step 7:

Stop and Start Tomcat using below scripts in bin folder under Tomcat installation directory.


Step 8:

Submit below URL now in browser now :


You should get a popup screen asking for credentials. Enter techkatak for both userid/pwd.. we added this in tomcat-users.xml file.

On successful validation, it will redirect you to the webservice page.


© 2015, All rights reserved.