use of org.apache.hello_world_soap_http.GreeterImpl 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.hello_world_soap_http.GreeterImpl in project cxf by apache.
the class EndpointReferenceTest method testEndpointGetEndpointReferenceInvalid.
@Test
public void testEndpointGetEndpointReferenceInvalid() throws Exception {
GreeterImpl greeter = new GreeterImpl();
try (EndpointImpl endpoint = new EndpointImpl(getBus(), greeter, (String) null)) {
endpoint.publish("http://localhost:8080/test");
try {
InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml");
Document doc = StaxUtils.read(is);
Element referenceParameters = fetchElementByNameAttribute(doc.getDocumentElement(), "wsa:ReferenceParameters", "");
endpoint.getEndpointReference(MyEndpointReference.class, referenceParameters);
fail("Did not get expected WebServiceException");
} catch (WebServiceException e) {
// do nothing
}
endpoint.stop();
}
}
use of org.apache.hello_world_soap_http.GreeterImpl in project cxf by apache.
the class Server method run.
protected void run() {
Object implementor;
String address;
implementor = new GreeterImpl();
address = "ws://localhost:" + PORT + "/SoapContext/SoapPort";
Endpoint ep = Endpoint.publish(address, implementor);
eps.add(ep);
// publish port with soap12 binding
address = "ws://localhost:" + PORT + "/SoapContext/SoapPort";
EndpointImpl e = (EndpointImpl) Endpoint.create(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING, new Greeter12Impl());
e.publish(address);
eps.add(e);
}
Aggregations