cxf CXF搭建webService服务器

2021-06-21 03:02

阅读:423

标签:get   server   ack   ring   服务器   3.1   oid   wsdl2java   ade   

http://observer.blog.51cto.com/4267416/1231205

手动发布:

public class ServerMain {

public static void main(String[] args) {
GradeService service = new GradeServiceImpl();
Endpoint.publish("http://localhost/webservices/services/Service", service);
}
}

客户端调用

package com.test.service;

public class ClientMain {

public static void main(String[] args) throws Exception {
GradeService_Service service = new GradeService_Service();
GradeService gradeServiceImplPort = service.getGradeServicePort();
System.out.println(gradeServiceImplPort.getGradeName(111));


//JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();

//Client client = clientFactory.createClient("http://localhost/webservices/services/Service?wsdl");

//Object[] result = client.invoke("getGradeName", 11);

//System.out.println(result[0]);
}
}

使用wsdl2java 生成的代码,运行时出现错误,删除包xfire-all-1.2.6可以运行了,实际不用导入任何包就可以运行。

注:wsdl2java 在 apache-cxf-3.1.12 的bin目录下面

cxf CXF搭建webService服务器

标签:get   server   ack   ring   服务器   3.1   oid   wsdl2java   ade   

原文地址:http://www.cnblogs.com/newlangwen/p/7183731.html


评论


亲,登录后才可以留言!