热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Java使用JaxWsDynamicClientFactory调取基于cxf的soap风格webservice的接口

WSDL路径StringwsUrlhttp:localhost:8082wsservicesbank?wsdl;方法名String
  //WSDL路径 
  String wsUrl = "http://localhost:8082/ws/services/bank?wsdl" ; //方法名
String method
= "getCaseProve"; JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(); Client client = factory.createClient(wsUrl); Endpoint endpoint = client.getEndpoint(); QName opName = new QName(endpoint.getService().getName().getNamespaceURI(), method); BindingInfo bindingInfo = endpoint.getEndpointInfo().getBinding(); System.out.println(client); if (bindingInfo.getOperation(opName) == null) { for (BindingOperationInfo operationInfo : bindingInfo.getOperations()) { if (method.equals(operationInfo.getName().getLocalPart())) { opName = operationInfo.getName(); break; } } }
  //请求报文   String xmlInput
= " unit + "\" HouseID=\"" + houseId + "\" RecHouseNum=\"" + recHouseNum + "\">";   Object[] res = null; try { res = client.invoke(opName, xmlInput); String xml = (String) res[0]; System.err.println("@@@@@@@@@@@@@@@@@"+xml); } catch (Exception e) { e.printStackTrace(); }

 


推荐阅读
author-avatar
杨子诺zoz_492
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有