由于只是调用服务,所以我这边只要实现一下spring环境下接入websevice就行了
第一中尝试的是使用spring ws的WebServiceTemplate
配置的方法如下:
<bean id="xxxWebService" class="org.springframework.ws.client.core.WebServiceTemplate">
<property name="defaultUri" value="http://XXX.net:8080"/>
</bean>
第二种尝试我用了jaxws
配置方法如下:
<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
<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,也是最后项目采用的方法 http://www.cnblogs.com/hoojo/archive/2011/03/30/1999563.html
<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