Posted on 2012-05-08 15:57
沙漠中的鱼 阅读(2888)
评论(0) 编辑 收藏 所属分类:
开源框架 、
Java
在Web.xml添加CXFServlet的配置
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
其中/services/*表示会拦截所有services下的访问路径。
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<context:annotation-config/>
<context:component-scan base-package="com.*.server.resource"></context:component-scan>
<!-- 登陆服务 -->
<jaxws:endpoint
id="LoginService"
implementor="com.*.ws.LoginService"
address="/ILoginService" >
</jaxws:endpoint>
</beans>
则当前CXF的访问路径为 http://url/projectname/services/ILoginService。
而不是:
http://url/projectname/ILoginService(注意添加services的路径)