更改JAX-WS服务URL [英] Change JAX-WS Service URL
问题描述
自动URL(在Glassfish 3上):在创建JAX-WS webservice时,是否有任何更改Webservice URL的可能性? > http://< host> /< context> /< Servicename>
,但我需要的是: http://< host> /<上下文> / axis / services /< Servicename>
(因为它是从轴到JAX-WS的一个端口)
有没有办法告诉JAX-WS在哪里发布WS?
使用sun-jaxws.xml是没有选择的,因为它禁用了@ EJB / @注入DI。
您可以为您的JAX-WS实现类指定servlet映射。默认情况下,不需要servlet映射,JAX-WS框架为您生成。由于您想为您的Web服务服务提供自定义URL映射,因此可以使用自定义URL提供Servlet映射。
$ b 示例:
< 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>
请参阅 https://geronimo.apache.org/GMOxDOC20/simple-web-service-with-jax-ws.html 和 http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Ftwbs_customwebxml.html 。
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.
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.
这篇关于更改JAX-WS服务URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!