1
votes

I'm been trying to deployed a simple web service on tomcat, but I have not success and it always return me 404 error.

I used the codes from this example

http://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat/

But not able to use the war, as I have context info set up in server.xml

So I use the same codes as mkyong, but deploy it with the steps on

How to manually deploy a web service on Tomcat 6?

I work on it until there is no more error in the catalina.log, still I got 404 error

When I look at the log, there are some messages like this

Feb 26, 2013 12:17:48 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized INFO: WSSERVLET12: JAX-WS context listener initializing Feb 26, 2013 12:17:49 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate INFO: WSSERVLET14: JAX-WS servlet initializing Feb 26, 2013 12:17:49 PM org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor trafficschoolgirls.com.xml Feb 26, 2013 12:17:49 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized INFO: WSSERVLET12: JAX-WS context listener initializing Feb 26, 2013 12:17:51 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate INFO: WSSERVLET14: JAX-WS servlet initializing

So my ws is set up right? But I'm really out of clue why it is still not working, is there any other log I can check or places I need to set up to have the ws running? Is there any port setting I need to do?

Thank you for your time,

Dolly

1

1 Answers

0
votes

I have two WebServices in Tomcat 6 in the same application.

There is two endpoints in the file /WEB-INF/sun-jaxws.xml with individual url-pattern

<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">
    <endpoint name="HtmlPageService" 
              implementation="org.paulvargas.tools.soap.HtmlPageService" 
              url-pattern="/HtmlPageService" />
    <endpoint name="BinaryFileService" 
              implementation="org.paulvargas.tools.soap.BinaryFileService" 
              url-pattern="/BinaryFileService" />
</endpoints>

And this url-pattern are also in the servlet-mapping of WSServlet

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
 <display-name>soap</display-name>
 <listener>
  <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
 </listener>
 <servlet>
  <servlet-name>Service</servlet-name>
  <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
  <load-on-startup>0</load-on-startup>
 </servlet>
 <servlet-mapping>
  <servlet-name>Service</servlet-name>
  <url-pattern>/HtmlPageService</url-pattern>
  <url-pattern>/BinaryFileService</url-pattern>
 </servlet-mapping>
 <welcome-file-list>
     <welcome-file>index.jsp</welcome-file>
 </welcome-file-list>
</web-app>

The application have the next libraries:

commons-io-2.4.jar
gmbal-api-only.jar
ha-api.jar
jaxb-impl.jar
jaxws-api.jar
jaxws-rt.jar
management-api.jar
mimepull-1.3.jar
policy.jar
stax-ex.jar
streambuffer.jar

The output on start Tomcat is

Feb 26, 2013 7:16:58 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 26, 2013 7:16:58 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 438 ms
Feb 26, 2013 7:16:58 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 26, 2013 7:16:58 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
Feb 26, 2013 7:16:58 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
INFO: WSSERVLET12: JAX-WS context listener initializing
Feb 26, 2013 7:16:59 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate <init>
INFO: WSSERVLET14: JAX-WS servlet initializing
Feb 26, 2013 7:16:59 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 26, 2013 7:16:59 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 26, 2013 7:16:59 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/17  config=null
Feb 26, 2013 7:16:59 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1608 ms

The go to URL http://localhost:8080/soap/HtmlPageService

        Service Name:   {http://soap.tools.paulvargas.org/}HtmlPageServiceService
           Port Name:   {http://soap.tools.paulvargas.org/}HtmlPageServicePort
             Address:   http://localhost:8080/soap/HtmlPageService
                WSDL:   http://localhost:8080/soap/HtmlPageService?wsdl
Implementation class:   org.paulvargas.tools.soap.HtmlPageService

        Service Name:   {http://soap.tools.paulvargas.org/}BinaryFileServiceService
           Port Name:   {http://soap.tools.paulvargas.org/}BinaryFileServicePort
             Address:   http://localhost:8080/soap/BinaryFileService
                WSDL:   http://localhost:8080/soap/BinaryFileService?wsdl
Implementation class:   org.paulvargas.tools.soap.BinaryFileService

I hope this can help you.