1.添加jar依赖
<!-- 整合Apache CXF WebService -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.1.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-core -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-core</artifactId>
<version>3.1.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-rt-transports-http -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.1.6</version>
</dependency>
2.web.xml 添加启动监听
<!-- cxf服务启动servlet -->
<servlet>
<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>/webService/*</url-pattern>
</servlet-mapping>
3 .在Spring配置文件整合cxf 注意 :请加入xsd信息加大加粗的字
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<!-- 配置方式2 这里用第二种适用于和jdk一样的客户端调用方式 第一种不适应jdk调用客户端的方式(下来再研究下) -->
<jaxws:endpoint implementor="pers.yaoliguo.bms.wxinterface.WxInterfaceImpl" address="/webSerciceTest_endpoint" ></jaxws:endpoint>
</bean>
</beans>
4.访问上面配置的地址
http://localhost:8080/bmsmaven/webService/webSerciceTest_endpoint?wsdl
注意:bmsmaven 项目名
webService web.xml定义的接口访问前缀
webSerciceTest_endpoint spring中配置的接口访问地址
在项目中访问时可能会受到springmvc 或shiro拦截 ,跳转到登陆的页面
放行这个 webService 前缀请求即可
5.访问上面配置的地址
客户端调用和jdk开发方式一样,可参考之前的文档!