Apache CXF客户端编写

拥有远程服务的接口与相关的DTO文件后(合作方给予或由WSDL生成),有两种方法编写客户端:

a) 使用在spring的applicationContext中定义: 

 

<jaxws:client id="infoWebService" serviceClass="com.iteye.examples.infos.ws.InfoWebService" address="http://localhost:8080/examples/ws/infoservice"></jaxws:client>
 

b)使用JAXWS的API动态创建:

 

JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
		proxyFactory.setAddress(address);
		proxyFactory.setServiceClass(InfoWebService.class);
		InfoWebService infoWebService = (InfoWebService) proxyFactory.create();

 

备注:address需要和jax-ws endpoint定义的address一样

例如使用了 http://localhost:8080/examples/ws/InfoService 字母大小写

服务器会报

warn [org.apache.cxf.transport.servlet.ServletController] - Can't find the request for http://localhost:8080/examples/ws/InfoService's Observer
 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值