1、pom.xml
<!-- cxf支持 -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.1.6</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.1.6</version>
</dependency>
因为项目中使用的springboot版本很老。所以没有使用cxf和springboot整合包
<!-- https://mvnrepository.com/artifact/org.apache.cxf/cxf-spring-boot-starter-jaxws -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.3.2</version>
</dependency>
2、贴代码
webServiceConfig.java
webService中接口的实现类
webService中接口
注意:接口中的targetNamespace一定要与实现类中的targetNamespace一致
如果想修改webservice样式可以使用@SOAPBinding注解进行修改。可以参考:
https://my.oschina.net/u/3358860/blog/3052244
如果想添加注释可以使用@WSDLDocumentation
如果想在报文中改变参数名称可以使用注解@WebParam
来源:oschina
链接:https://my.oschina.net/u/3358860/blog/3052252