1、在pom.xml中添加cxf的包
2、在spring配置文件中添加配置<!-- 配置Spring3的版本属性 --><org.springframework.version>3.0.7.RELEASE</org.springframework.version><!-- 配置CXF的版本属性 --><cxf.version>2.4.8</cxf.version>
<!-- SPRING --><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>${org.springframework.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jms</artifactId><version>${org.springframework.version}</version></dependency>
<!-- CXF START --><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-frontend-jaxws</artifactId><version>${cxf.version}</version></dependency><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-transports-http</artifactId><version>${cxf.version}</version></dependency><!-- CXF END -->
<dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.14</version></dependency>
1)首先一定要引入下面三个配置文件
<import resource="classpath:META-INF/cxf/cxf.xml" />2)添加需要发布成webservice的实现类配置
<import resource="classpath:META-INF/cxf/cxf-extension-xml.xml" /><import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<!-- FSSC报账单信息同步接口 --><bean id="ISynTaxCostTypeImpl"class="com.deppon.fims.inter.fssc.service.webservice.ISynTaxCostTypeImpl" /><jaxws:endpoint id="synTaxCostType" implementor="#ISynTaxCostTypeImpl"address="/synTaxCostType" />
3、在web.xml中添加如下配置
<context-param><param-name>contextConfigLocation</param-name><param-value>classpath:applicationContext-*.xml</param-value></context-param><!-- Spring配置 --><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><!-- Spring的log4j监听器 --><listener><listener-class>org.springframework.web.util.Log4jConfigListener</listener-class></listener><!-- CXF配置 --><servlet><servlet-name>CXFService</servlet-name><servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>CXFService</servlet-name><url-pattern>/webservice/*</url-pattern></servlet-mapping>