创建webservice服务端以及生成客户端进行调用

1.准备jar包
apache-cxf-2.3.3.zip
2.客户端具体部分查看
http://www.tuicool.com/m/articles/jQraum

3.wsdl2java生成客户端
3.1切换到需要生成文件的目录
3.2执行C:\Users\Administrator\Desktop\webservice\apache-cxf\apache-cxf-2.3.3\apache-cxf-2.3.3\bin\wsdl2java http://localhost:8080/chh/Users?wsdl

3.将客户端贴到你的项目里就可以调用对方的方法了
ComplexUserServiceService factory = new ComplexUserServiceService();//这个继承service方法的类就是服务类
// 此处返回的只是远程WebService的代理
IComplexUserService helloWorld = factory.getComplexUserServicePort();//通过这个服务类获取端口
User user = helloWorld.getUserByName("zhangsan");//通过这个端口调用方法,返回对象在生成的类也有

posted on 2016-03-14 22:33  jcj_2012  阅读(165)  评论(0编辑  收藏  举报

导航