JavaSOAPWebServices

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 Hello.java 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(metro.java.net)and 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:

 

proj

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

http://localhost:8080/SOAPWS/jaxws

If successful it should show following page :

ws

 

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

http://localhost:8080/SOAPWS/jaxws?xsd=1

schema

 

 

 

 

 
 

 

 

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

© 2015, www.techkatak.com. All rights reserved.

One thought on “JAX WS using Eclipse and Tomcat

Comments are closed.