1、将外部系统提供的webservice地址通过cmd解析出java的webservice客户端文件(解析出之后会有一个interface接口);
2、配置cxf-client.xml文件(
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd">
<!--DE36接口-->
<jaxws:client id="DE36" address="http://xxx.xx.xxx.xx:8080/dewms/DE36?wsdl" serviceClass="com.smart..soap.cxf.client.DE36">
</jaxws:client>
</beans>
);
3、之后调用interface接口(DE36就是这个接口的名字)
导包(注解)
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
导包(解析地址得到的类)
import com.smart.soap.cxf.client.DE36;
import com.smart.soap.cxf.client.De36Request;
之后可以给外部系统传数据了。
@Autowired
@Qualifier("DE36")
private DE36 DE36Service;
下面给出这两个注解的解释连接:点击打开链接
@Autowired 可以对成员变量、方法以及构造函数进行注释,而 @Qualifier 的标注对象是成员变量、方法入参、构造函数入参。