几种常用的webservice客户端和spring集成的方法

xiaoxiao2021-02-28  16

由于只是调用服务,所以我这边只要实现一下spring环境下接入websevice就行了

第一种尝试的是使用spring ws的WebServiceTemplate

配置的方法如下:

? 1 2 3          < bean  id = "xxxWebService"  class = "org.springframework.ws.client.core.WebServiceTemplate" >              < property  name = "defaultUri"  value = "http://XXX.net:8080" />          </ bean >

第二种尝试我用了jaxws

配置方法如下:

? 1 2 3 4 5      < bean  id = "xxxWebService"  class = "org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean" >          < property  name = "serviceInterface"  value = "com.xxx.UploadFileService" />          < property  name = "namespaceUri"  value = "http://XXX.net:8080" />          < property  name = "wsdlDocumentUrl"  value = "http://XXX.net:8080/XXXServicePort?WSDL"  />      </ bean >

第3种我尝试的是CXF

? 1 2 3 4 5 6 7    < 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:client  id = "xxxWebService"  serviceClass = "com.xxx.UploadFileService"                 address = "http://XXX.net:8080" >        </ jaxws:client >

第4种我用的是xfire,也是最后项目采用的方法

? 1 2 3 4 5 6 7 8    < bean  id ="dwdsspWebService" class ="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean">          < property  name ="serviceClass">              < value >com.xxx.UploadFileService</ value >          </ property >          < property  name ="wsdlDocumentUrl">              < value >http://XXX.net:8080/XXXServicePort?WSDL</ value >          </ property >      </ bean >

参考文档:http://blog.csdn.net/kkdelta/article/details/3987591

http://blog.csdn.net/kkdelta/article/details/7290769

http://blog.csdn.net/jadyer/article/details/9002984

http://blog.csdn.net/vickychen89/article/details/6606571

http://coach.iteye.com/blog/894159

转载请注明原文地址: https://www.6miu.com/read-2602707.html

最新回复(0)