`
yangsongjing
  • 浏览: 242633 次
  • 性别: Icon_minigender_1
  • 来自: 湖南
社区版块
存档分类
最新评论
阅读更多
1. 新建java web工程,导入cxf压缩文件lib目录下的所有jar包到工程的WEB-INF下的lib目录下面。
2.applicationContext.xml 加入这个配置文件
3. 配置下webxml
4. 发布服务的方法有两种可以代码发布也可以启动服务器。代码发布不需要applicationContext.xml ,用tomcat就需要。具体案例可以下载。

服务测试

public static String callService(String wsUrl, String method, Object... arg)
throws Exception {
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
Client client = dcf.createClient(wsUrl);
Object[] res = client.invoke(method, arg);
return (String) res[0];
}

String s = WebServiceApp.callService(
"http://localhost:8080/TestCxf_Service/MainCxfService?wsdl",
"doOther");// 如果有参数直接写在后面
1
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics