Apache CXF和Servlet映射 [英] Apache CXF and servlet-mapping

查看:229
本文介绍了Apache CXF和Servlet映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习Apache CXF的一些基础知识,以及有关servlet映射的一般知识。
,我在这里修改了代码:

I am trying to learn some basics of Apache CXF and generally about servlet-mappings. and I have modified the code here:

https://subversion.assembla.com/svn/pablo-examples/spring-cxf-example

我已经在web.xml中如下配置了CXFServlet映射

I have configured CXFServlet mapping as below in web.xml

<servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
</servlet-mapping>

春季xml(webservice-definition-beans.xml)
我已经生成了如下所示的服务

in the spring xml(webservice-definition-beans.xml) I have generated the service as below

<jaxws:endpoint id="helloWorld" implementor="#helloWorldService" address="/services/HelloWorld" />

我期望通过此url访问服务wsdl

I was expecting to access to the service wsdl via this url

http://localhost:8080/services/HelloWorld?wsdl

但它是

http://localhost:8080/services/services/HelloWorld?wsdl

我在这里知道吗?

在这里看来,它也改变了上下文。

In here It seems it also changes context.

推荐答案

JAX-WS路径是相对于servlet映射的。

The JAX-WS path is relative to servlet mapping. If you want

http://localhost:8080/services/HelloWorld?wsdl

使用

<servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<jaxws:endpoint id="helloWorld" implementor="#helloWorldService" address="/services/HelloWorld" />

<servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
</servlet-mapping>

<jaxws:endpoint id="helloWorld" implementor="#helloWorldService" address="/HelloWorld" />

这篇关于Apache CXF和Servlet映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆