Skip to main content

WSServlet and Multiple Web Services

1 reply [Last post]
alexvs
Offline
Joined: 2007-12-17
Points: 0

Is this possible? How would the web.xml file look like when more than one web service is deployed on the server?

I tried to add another servlet-mapping to the servlet pointing to the new web service but that obviously did not work. I am puzzled; how to deploy multiple web services using JAX-WS?

Or is it true that each web service must reside inside _its own_ web application?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ismail_m1979
Offline
Joined: 2006-02-14
Points: 0

You can reuse the same servlet (WSServlet) to pick up requests in different URL patterns (/service1, and /service2). In the sun-jaxws.xml, you can have appropriate endpoints for each of the url patterns.

[i][b]web.xml[/b][/i]

JAX-WS endpoint - fromjava
jaxws-servlet
jaxws-servlet
com.sun.xml.ws.transport.http.servlet.WSServlet
1


jaxws-servlet
/service1


jaxws-servlet
/service2

[i][b]sun-jaxws.xml[/b][/i]

name='service1 implementation'
implementation='service1 implementation class here'
url-pattern='/service1'/>
name='service2 implementation'
implementation='service2 implementation class here'
url-pattern='/service2'/>

Hope this helps.

Regards,
Malik