*
The moose likes Web Services and the fly likes JAX WS URL mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX WS URL mapping" Watch "JAX WS URL mapping" New topic
Author

JAX WS URL mapping

Rabi Kumar
Greenhorn

Joined: Aug 13, 2009
Posts: 6
I am trying to build a webservice using JAX-WS.

The endpoint URL of my service is like: http://host:port/contextroot/MyService

However, I would like to expose my service using the following URL: http://host:port/contextroot/services/MyService without changing the namespaces in WSDL.

Any help is appreciated.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Have you tried to modify the servlet-mapping in the web.xml deployment descriptor in the web service WAR (assuming you deploy the web service in a WAR)?
Best wishes!
Rabi Kumar
Greenhorn

Joined: Aug 13, 2009
Posts: 6
I deploy using EAR/war. However my web.xml is empty. I dont see my webservice defined as a servlet there.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Right, you do not need to define web services in the web.xml deployment descriptor, but if you have special requirements, like you seem to have, you can use the web.xml deployment descriptor.
Best wishes!
Rabi Kumar
Greenhorn

Joined: Aug 13, 2009
Posts: 6
I changed the contextroot in application.xml of EAR file as follows and I am able to achieve the desired behavior:

Old:
<contextroot>mycontextroot</contextroot>

New:
<contextroot>mycontextroot/services</contextroot>
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Thanks for sharing your solution!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAX WS URL mapping
 
Similar Threads
JAX-WS Authentication problem -javax.xml.ws.WebServiceException Response: '401: Unauthorized'
Web service Interoperability
non-SOAP axis2 web service
JAX-WS
Stateful Web Service