webservice與springboot整合

一、pom.xmljava

<!-- 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>web

由於項目中使用的springboot版本很老。因此沒有使用cxf和springboot整合包spring

<!-- 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>
二、貼代碼apache

webServiceConfig.javaspringboot

webService中接口的實現類frontend

webService中接口spring-boot

注意:接口中的targetNamespace必定要與實現類中的targetNamespace一致spa

若是想修改webservice樣式可使用@SOAPBinding註解進行修改。能夠參考:.net

https://my.oschina.net/u/3358860/blog/3052244xml

若是想添加註釋可使用@WSDLDocumentation

若是想在報文中改變參數名稱可使用註解@WebParam

相關文章
相關標籤/搜索