use of org.apache.cxf.calculator.CalculatorImpl in project cxf by apache.
the class JaxWsServerFactoryBeanTest method testJaxwsServiceClass.
@Test
public void testJaxwsServiceClass() throws Exception {
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceClass(CalculatorPortType.class);
factory.setServiceBean(new CalculatorImpl());
String address = "http://localhost:9001/jaxwstest";
factory.setAddress(address);
Server server = factory.create();
Endpoint endpoint = server.getEndpoint();
ServiceInfo service = endpoint.getEndpointInfo().getService();
assertNotNull(service);
Bus bus = factory.getBus();
Definition def = new ServiceWSDLBuilder(bus, service).build();
WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter();
def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
Document doc = wsdlWriter.getDocument(def);
Map<String, String> ns = new HashMap<>();
ns.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
ns.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
XPathUtils xpather = new XPathUtils(ns);
xpather.isExist("/wsdl:definitions/wsdl:binding/soap:binding", doc, XPathConstants.NODE);
xpather.isExist("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='add']/soap:operation", doc, XPathConstants.NODE);
xpather.isExist("/wsdl:definitions/wsdl:service/wsdl:port[@name='add']/soap:address[@location='" + address + "']", doc, XPathConstants.NODE);
}
Aggregations