use of javax.wsdl.Definition in project cxf by apache.
the class CodeFirstWSDLTest method testWSDL1.
@Test
public void testWSDL1() throws Exception {
Definition d = createService(Hello2.class);
QName serviceName = new QName("http://service.jaxws.cxf.apache.org/", "Hello2Service");
javax.wsdl.Service service = d.getService(serviceName);
assertNotNull(service);
QName portName = new QName("http://service.jaxws.cxf.apache.org/", "Hello2Port");
javax.wsdl.Port port = service.getPort(portName.getLocalPart());
assertNotNull(port);
QName portTypeName = new QName("http://service.jaxws.cxf.apache.org/", "HelloInterface");
javax.wsdl.PortType portType = d.getPortType(portTypeName);
assertNotNull(portType);
assertEquals(5, portType.getOperations().size());
}
use of javax.wsdl.Definition in project cxf by apache.
the class CodeFirstWSDLTest method testOnlyRootElementOnFaultBean.
@Test
public void testOnlyRootElementOnFaultBean() throws Exception {
// CXF-4016
EndpointImpl ep = (EndpointImpl) Endpoint.publish("local://foo4016", new CXF4016Impl());
ServiceWSDLBuilder wsdlBuilder = new ServiceWSDLBuilder(bus, ep.getService().getServiceInfos().get(0));
Definition def = wsdlBuilder.build();
Document d = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter().getDocument(def);
this.addNamespace("http://www.example.org/contract/DoubleIt", "tns");
// org.apache.cxf.helpers.XMLUtils.printDOM(d);
assertXPathEquals("//xsd:element/@ref", new QName("http://www.example.org/contract/DoubleIt", "CustomMessageBean"), d);
}
use of javax.wsdl.Definition in project cxf by apache.
the class CodeFirstWSDLTest method testWSDL2.
@Test
public void testWSDL2() throws Exception {
Definition d = createService(Hello3.class);
QName serviceName = new QName("http://mynamespace.com/", "MyService");
javax.wsdl.Service service = d.getService(serviceName);
assertNotNull(service);
QName portName = new QName("http://mynamespace.com/", "MyPort");
javax.wsdl.Port port = service.getPort(portName.getLocalPart());
assertNotNull(port);
QName portTypeName = new QName("http://service.jaxws.cxf.apache.org/", "HelloInterface");
javax.wsdl.PortType portType = d.getPortType(portTypeName);
assertNotNull(portType);
assertEquals(5, portType.getOperations().size());
}
use of javax.wsdl.Definition 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);
}
use of javax.wsdl.Definition in project cxf by apache.
the class CodeFirstTest method testWrappedModel.
@Test
public void testWrappedModel() throws Exception {
Definition d = createService(true);
Document wsdl = WSDLFactory.newInstance().newWSDLWriter().getDocument(d);
addNamespace("svc", "http://service.jaxws.cxf.apache.org");
assertValid("/wsdl:definitions/wsdl:service[@name='HelloService']", wsdl);
assertValid("//wsdl:port/wsdlsoap:address[@location='" + address + "']", wsdl);
assertValid("//wsdl:portType[@name='Hello']", wsdl);
assertValid("/wsdl:definitions/wsdl:message[@name='sayHi']" + "/wsdl:part[@element='tns:sayHi'][@name='parameters']", wsdl);
assertValid("/wsdl:definitions/wsdl:message[@name='sayHiResponse']" + "/wsdl:part[@element='tns:sayHiResponse'][@name='parameters']", wsdl);
assertValid("//xsd:complexType[@name='sayHi']" + "/xsd:sequence/xsd:element[@name='arg0']", wsdl);
}
Aggregations