use of org.apache.nested_callback.SOAPService 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/NestedCallbackPort";
Endpoint.publish(address, implementor);
URL wsdlURL = getClass().getResource("/wsdl/nested_callback.wsdl");
SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
ServerPortType port = ss.getPort(PORT_NAME, ServerPortType.class);
updateAddressPort(port, PORT);
EndpointReferenceType ref = null;
try {
ref = EndpointReferenceUtils.getEndpointReference(wsdlURL, SERVICE_NAME_CALLBACK, PORT_NAME_CALLBACK.getLocalPart());
EndpointReferenceUtils.setInterfaceName(ref, PORT_TYPE_CALLBACK);
EndpointReferenceUtils.setAddress(ref, address);
} catch (Exception e) {
e.printStackTrace();
}
NestedCallback callbackObject = new NestedCallback();
Source source = EndpointReferenceUtils.convertToXML(ref);
W3CEndpointReference w3cEpr = new W3CEndpointReference(source);
callbackObject.setCallback(w3cEpr);
String resp = port.registerCallback(callbackObject);
assertEquals("registerCallback called", resp);
}
Aggregations