This discussion is archived
0 Replies Latest reply: Sep 27, 2012 12:24 AM by 848602 RSS

JAX-WS mapping one servlet to multiple URLs

848602 Newbie
Currently Being Moderated
Hi. I have a JAX WS web service define like this:
package yohoo;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public class Foo
{
  @WebMethod
  public String doSomething()
  {
    return "done";
  }
}
And I attempted to map the web service multiple time on web.xml:
<servlet>
  <servlet-name>FooWS</servlet-name>
  <servlet-class>yohoo.Foo</servlet-class>
</servlet>

 <servlet-mapping>
  <servlet-name>FooWS</servlet-name>
  <url-pattern>/one/FooWS</url-pattern>
 </servlet-mapping>
 
 <servlet-mapping>
  <servlet-name>FooWS</servlet-name>
  <url-pattern>/two/FooWS</url-pattern>
 </servlet-mapping>
However when I tried to request the WSDL via the second mapping I got an exception (JBoss 7). Is this a feature that should be supported or am I doing something totally wrong?
javax.servlet.ServletException: Cannot obtain destination for: /TestWS/two/FooWS
     org.jboss.wsf.stack.cxf.RequestHandlerImpl.findDestination(RequestHandlerImpl.java:164)
     org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:81)
     org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:169)
     org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:87)
     org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)
     org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:113)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
     org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:135)
     org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:140)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points