webservice实际应用之调用外部系统提供的服务端地址,写java的webservice客户端程序并通过接口给外部系统传数据

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 的标注对象是成员变量、方法入参、构造函数入参。

 @Qualifier("XXX") 中的 XXX是 Bean 的名称,所以 @Autowired 和 @Qualifier 结合使用时,自动注入的策略就从 byType 转变成 byName 了。
 @Qualifier("XXX") 中的 XXX是cxf-client.xml配置文件中<!--DE36接口-->的id="DE36"

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值