Change JAX-WS Service URL

前端 未结 2 746
无人及你
无人及你 2021-01-03 04:32

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

The automatic URL is (on Glassfish 3): http:///

相关标签:
2条回答
  • 2021-01-03 04:52

    I got the same problem with the same context. Some axis2 web services to pass in JAX-WS ; so I had to keep the same url mapping (http://[host]:[port]/[context]/services/[serviceName]).

    At first, I tried with @WebServlet annotation with an url pattern on the impl class of the WS. It works on JBoss AS 7.1 and Weblogic Server 12 but WebSphere AS 8 didn't like. This is because of the non extending of HttpServlet class but if you done the same by the web.xml, it works.

    For one web service to add in web.xml :

    <servlet>
        <servlet-name>OMInjector</servlet-name>
        <servlet-class>fr.fmoisson.kijq.services.OMInjector</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>OMInjector</servlet-name>
        <url-pattern>/services/OMInjector</url-pattern>
    </servlet-mapping>
    
    0 讨论(0)
  • 2021-01-03 05:01

    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.

    0 讨论(0)
提交回复
热议问题