use of javax.xml.ws.EndpointReference in project cxf by apache.
the class Client method main.
public static void main(String[] args) throws Exception {
// Use WS-Discovery to find references to services that implement the Greeter portType
WSDiscoveryClient client = new WSDiscoveryClient();
List<EndpointReference> references = client.probe(new QName("http://cxf.apache.org/hello_world/discovery", "Greeter"));
client.close();
GreeterService service = new GreeterService();
// loop through all of them and have them greet me.
for (EndpointReference ref : references) {
Greeter g = service.getPort(ref, Greeter.class);
System.out.println(g.greetMe("World"));
}
}
use of javax.xml.ws.EndpointReference in project cxf by apache.
the class CallbackClientServerTest method testCallback.
@Test
public void testCallback() throws Exception {
Object implementor = new CallbackImpl();
String address = "http://localhost:" + CB_PORT + "/CallbackContext/CallbackPort";
Endpoint ep = Endpoint.publish(address, implementor);
URL wsdlURL = getClass().getResource("/wsdl/basic_callback_test.wsdl");
SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
ServerPortType port = ss.getPort(PORT_NAME, ServerPortType.class);
updateAddressPort(port, PORT);
EndpointReference w3cEpr = ep.getEndpointReference();
String resp = port.registerCallback((W3CEndpointReference) w3cEpr);
assertEquals("registerCallback called", resp);
ep.stop();
}
use of javax.xml.ws.EndpointReference in project cxf by apache.
the class EndpointReferenceTest method testEndpointGetEndpointReferenceSOAPBinding.
@Test
public void testEndpointGetEndpointReferenceSOAPBinding() throws Exception {
GreeterImpl greeter = new GreeterImpl();
try (EndpointImpl endpoint = new EndpointImpl(getBus(), greeter, (String) null)) {
endpoint.publish("http://localhost:8080/test");
InputStream is = getClass().getResourceAsStream("resources/hello_world_soap_http_infoset.xml");
Document doc = StaxUtils.read(is);
Element referenceParameters = fetchElementByNameAttribute(doc.getDocumentElement(), "wsa:ReferenceParameters", "");
EndpointReference endpointReference = endpoint.getEndpointReference(referenceParameters);
assertNotNull(endpointReference);
assertTrue(endpointReference instanceof W3CEndpointReference);
// A returned W3CEndpointReferenceMUST also contain the specified referenceParameters.
// W3CEndpointReference wer = (W3CEndpointReference)endpointReference;
endpoint.stop();
}
}
use of javax.xml.ws.EndpointReference 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 javax.xml.ws.EndpointReference in project cxf by apache.
the class EndpointReferenceTest method testBindingProviderSOAPBindingStaicService.
@Test
public void testBindingProviderSOAPBindingStaicService() throws Exception {
org.apache.hello_world_soap_http.SOAPService s = new org.apache.hello_world_soap_http.SOAPService();
Greeter greeter = s.getPort(Greeter.class);
BindingProvider bindingProvider = (BindingProvider) greeter;
EndpointReference er = bindingProvider.getEndpointReference();
assertNotNull(er);
// If the BindingProvider instance has a binding that is either SOAP 1.1/HTTP or SOAP
// 1.2/HTTP, then a W3CEndpointReference MUST be returned.
assertTrue(er instanceof W3CEndpointReference);
}
Aggregations