JAX-WS webservice deployment example in Tomcat Server

We have seen that we have successfully created the jax-ws webservice example tutorial and also published and tested the service successfully.

Now we want to deploy the service in Tomcat Server.
Prerequisites

JDK 1.6
Eclipse 3.6
Tomcat Server v7
List of jars
jax-ws webservice example

We have the same endpoint interface and implementation class as we have in the previous tutorial.

Now we need to generate request and response structure. So we will use wsgen command from command prompt. Go to the project root directory. For example, if your project full path is “c:\eclipse_workspace\jax-ws” then go to the project home path(“c:\eclipse_workspace\jax-ws”) and execute the below command in command prompt.

 

You will get two generated classes SayHello.java and SayHelloResponse.java under package in.webtuts.service.jaxws

SayHello.java

 

SayHelloResponse.java

 

Now modify the deployment descriptor file so that it looks like below. Add jax-ws webservice listener class.

 

Create another sun-jaxws.xml file and put it under WEB-INF directory. This file is used to recognize the jax-ws endpoint service.

 

Now run the web project on Tomcat Server from Eclipse. You can also export the project as war file and put the war file under tomcat’s webapp directory. Run the Tomcat server.

Now access the URL http://localhost:8080/jax-ws-ssl/hello You will get the below output.

 

To access the WSDL directly use URL http://localhost:8080/jax-ws-ssl/hello?wsdl

We will see how to test the service after generating client/stub from the WSDL file in another tutorial.

Thanks for your reading. Please leave a comment if you 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.