1、JaxWsDynamicClientFactory:
JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance(); Client client = clientFactory.createClient("http://IP:端口/iemr/webservice/IEMRWebService?wsdl"); // 下面一段处理 WebService接口和实现类namespace不同的情况 // CXF动态客户端在处理此问题时,会报No operation was found with the name的异常 String wsOperation="getMrPdfList";//ws调用方法 Endpoint endpoint = client.getEndpoint(); QName opName = new QName(endpoint.getService().getName().getNamespaceURI(),wsOperation); BindingInfo bindingInfo = endpoint.getEndpointInfo().getBinding(); if (bindingInfo.getOperation(opName) == null) { for (BindingOperationInfo operationInfo : bindingInfo.getOperations()) { if (wsOperation.equals(operationInfo.getName().getLocalPart())) { opName = operationInfo.getName(); break; } } } Object[] result = client.invoke(opName,enPk,true,false); String xmlReturn=(String)result[0];
2、JaxWsProxyFactoryBean:
private UnDocPdfWebService createUnDocPdfWs(){ JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); //带有@WebService注解的接口类 factory.setServiceClass(UnDocPdfWebService.class); //不带?wsdl的WS调用地址 factory.setAddress(unDocPdfWsUrl); UnDocPdfWebService service = (UnDocPdfWebService)factory.create(); return service; }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。