use of org.apache.cxf.jaxws.spi.ProviderImpl in project cxf by apache.
the class EndpointReferenceTest method testProviderReadEndpointReference.
@Test
public void testProviderReadEndpointReference() throws Exception {
ProviderImpl provider = new ProviderImpl();
InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml");
Document doc = StaxUtils.read(is);
DOMSource erXML = new DOMSource(doc);
EndpointReference endpointReference = provider.readEndpointReference(erXML);
assertNotNull(endpointReference);
assertTrue(endpointReference instanceof W3CEndpointReference);
}
use of org.apache.cxf.jaxws.spi.ProviderImpl in project cxf by apache.
the class EndpointReferenceTest method testProviderGetPort.
@Test
public void testProviderGetPort() throws Exception {
BusFactory.setDefaultBus(getBus());
GreeterImpl greeter1 = new GreeterImpl();
try (EndpointImpl endpoint = new EndpointImpl(getBus(), greeter1, (String) null)) {
endpoint.publish("http://localhost:8080/test");
ProviderImpl provider = new ProviderImpl();
InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml");
Document doc = StaxUtils.read(is);
DOMSource erXML = new DOMSource(doc);
EndpointReference endpointReference = EndpointReference.readFrom(erXML);
WebServiceFeature[] wfs = new WebServiceFeature[] {};
Greeter greeter = provider.getPort(endpointReference, Greeter.class, wfs);
String response = greeter.greetMe("John");
assertEquals("Hello John", response);
}
}
use of org.apache.cxf.jaxws.spi.ProviderImpl in project cxf by apache.
the class EndpointReferenceTest method testProviderCreateW3CEndpointReference.
@Test
public void testProviderCreateW3CEndpointReference() throws Exception {
ProviderImpl provider = new ProviderImpl();
InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml");
Document doc = StaxUtils.read(is);
Element referenceParameter = fetchElementByNameAttribute(doc.getDocumentElement(), "wsa:ReferenceParameters", "");
List<Element> referenceParameters = new ArrayList<>();
if (referenceParameter != null) {
referenceParameters.add(referenceParameter);
}
Element metadata = fetchElementByNameAttribute(doc.getDocumentElement(), "wsa:metadata", "");
List<Element> metadataList = new ArrayList<>();
if (metadata != null) {
metadataList.add(metadata);
}
W3CEndpointReference endpointReference = provider.createW3CEndpointReference("http://localhost:8080/test", serviceName, portName, metadataList, "wsdlDocumentLocation", referenceParameters);
assertNotNull(endpointReference);
}
Aggregations