`
卡拉阿风
  • 浏览: 99542 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

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
 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics