How to deploy SOAP Web Service on Tomcat 7

17.5k Views Asked by At

How do I deploy a SOAP Web Service on Tomcat 7?

I have successfully published my Web Service using Eclipse:

"Endpoint.publish("http://localhost:786/AddWebservice", new Operation())"

From here I have no idea how to publish the same Web Service on a Tomcat Server.

3

There are 3 best solutions below

0
On

Deploy JAX-WS web services on Tomcat servlet container. See following summary steps of a web service deployment.

  1. Create a web service (of course).
  2. Create a sun-jaxws.xml, defines web service implementation class.
  3. Create a standard web.xml, defines WSServletContextListener, WSServlet and structure of a web project.
  4. Build tool to generate WAR file.
  5. Copy JAX-WS dependencies to “${Tomcat}/lib” folder.
  6. Copy WAR to “${Tomcat}/webapp” folder.
  7. Start It.

See the below example SOAP in Tomcat

0
On

The one way can be used to publish the endpoint is to create a servlet and within doGet() method, publish your endpoint as "Endpoint.publish("your_URL", new Operation())" then use "your_URL", to hit the service.

0
On

If building as a Maven project, a simple and consistent way to gather runtime dependencies is to add the following dependency (adjust version):

<!-- runtime for JAX-WS (servlet implementation) -->
<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>2.2.10</version>
</dependency>