配置文件1:(web.xml配置文件 加入cxf相关配置文件)
<!-- CXF Web Services 配置信息 -->
<servlet>
<display-name>CXF Servlet</display-name>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern><!--注意这里的配置/services/ 这里是生成wsdl路径的一部分,wsdl的路径:http://ip:8080/项目路径/services/spring cxf配置文件中的address?wsdl-->
</servlet-mapping>
配置文件2:(spring cxf 配置文件)
<?xml version="1.0" encoding="UTF-8"?>
<!-- START SNIPPET: beans -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
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">
<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" />
<jaxws:endpoint
id="helloWorld"
implementor="com.cslc.crius.common.ws.cxf.server.HelloWorldImpl"
address="/HelloWorld" />
<jaxws:endpoint
id="workUnitInfo"
implementor="#workUnitInfoImpl"
address="/WorkUnitInfo"
/>
<bean id="workUnitInfoImpl" class="com.cslc.crius.common.ws.cxf.server.WorkUnitInfoImpl">
<!--如果webservice中有需要加载其他类,采用注解的方式不行,需要在配置文件中显示声明-->
<property name="workUnitService" ref="workUnitServiceImpl"></property>
</bean>
</beans>
<!-- END SNIPPET: beans -->
以上几步完成以后既可以进行相关的测试了,发布到tomcat服务器中,启动服务器。
