cxf publish

Object implementor = new ImplPLMToArchiveWSSoap();
String address = "http://localhost:4931/soa";
Endpoint.publish(address, implementor);

http://localhost:4931/soa?wsdl(即Endpoint.publish的address+"?wsdl")可以查看到wsdl

客户端访问
String check_key = "PLM-ARCHIVE";
String wsdl_url = "http://localhost:4931/soa?wsdl";
String namespace_url = "http://server.lantai.integration/";
String service_name = "ImplPLMToArchiveWSSoapService";

QName SERVICE_NAME = new QName(namespace_url, service_name);
//use Service.create to create Service instances
Service service = Service.create(wsdlURL, SERVICE_NAME);
PLMToArchiveWSSoap port = service.getPort(PLMToArchiveWSSoap.class);

这里重点介绍两个参数
1)namespace_url,wsdl:definitions中targetNamespace属性的值
2)service_name,wsdl:service中的name属性的值

猜你喜欢

转载自openstudy.iteye.com/blog/1168782
CXF
今日推荐