`
lynnwoo
  • 浏览: 34054 次
  • 性别: Icon_minigender_2
  • 来自: 武汉
社区版块
存档分类
最新评论

java代码动态调用web service

阅读更多
// 动态客户端
org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
org.apache.cxf.endpoint.Client client =  dcf.createClient("http://localhost:8080/project/ws/PMSDeviceService?wsdl");	

Object[] result = client.invoke("getDeviceList","sysadmin","A3F4E6A69DE1F316EFA8EA36A788ED56","1003$1");
System.out.println(result[0]);

    invoke方法第一个参数是所调用web service方法名,后面参数为该方法的参数。
分享到:
评论
3 楼 censhenping 2012-03-13  
在你接口的实现方法中的@WebService(endpointInterface = "接口")加上属性:targetNamespace = "命名空间",属性的值是你打开http://localhost:8080/project/ws/PMSDeviceService?wsdl获取你命名空间的值
2 楼 heliang0915 2011-07-27  
希望牛人指点一下啊!
1 楼 heliang0915 2011-07-27  
但是为什么我的cxf程序报错呢?
Exception in thread "main" org.apache.cxf.common.i18n.UncheckedException: No operation was found with the name {http://server.actionsoft.com/}sayHi.
我的接口方法中明明有sayHi方法的定义

相关推荐

Global site tag (gtag.js) - Google Analytics