Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change JAX-WS Service URL

Is there any Possibility to change the Webservice URL when creating a JAX-WS webservice?

The automatic URL is (on Glassfish 3): http://<host>/<context>/<Servicename>, but what i need is: http://<host>/<context>/axis/services/<Servicename> (because it is a port from axis to JAX-WS)

Is there any way to tell JAX-WS where to publish a WS?

Using sun-jaxws.xml is no option, because it disables @EJB/@Inject DI.

like image 453
huzi Avatar asked Oct 04 '22 13:10

huzi


1 Answers

You can specify the servlet mapping for your JAX-WS implementation class. By default, the servlet mapping is not required and JAX-WS framework generates it for you. As you want to provide a custom URL mapping for your web service service, you can provide a servlet mapping with the custom URL.

Sample:

<servlet>
    <display-name>CalculatorService</display-name>
    <servlet-name>CalculatorService</servlet-name>
    <servlet-class>
        org.apache.geronimo.samples.jws.CalculatorService
    </servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>CalculatorService</servlet-name>
    <url-pattern>/axis/services/calculator</url-pattern>
</servlet-mapping>

Refer to https://geronimo.apache.org/GMOxDOC20/simple-web-service-with-jax-ws.html and http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Ftwbs_customwebxml.html.

like image 70
Rama Krishna Sanjeeva Avatar answered Oct 07 '22 20:10

Rama Krishna Sanjeeva