JAX WS using Eclipse and Tomcat

In this post, we will create a JAX WS service using Eclipse IDE and deploy it on Tomcat server.

Let’s create a Dynamic web project named SOAPWS in Eclipse.

Create a package com.techkatak and a create class file in it.

@WebService annotation marks this class as a webservice.

To deploy this webservice in Tomcat or Jetty server, we need two files :

1) web.xml

2) sun-jaxws.xml


Add the following code for web.xml:


Here is the code for sun-jaxws.xml:

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)


Now, here is the project structure for SOAPWS project we created:



Once the webservice is deployed,  you can verify the service status using following url in browser:


If successful it should show following page :



The xml schema associated with this service can be accessed using :










References :
Metro project documentation
Java Web Services up and running
JAX-WS Reference Implementation – Project Kenai

© 2015, All rights reserved.

One thought on “JAX WS using Eclipse and Tomcat

Comments are closed.