Search in sources :

Example 1 with NestedCallback

use of org.apache.nested_callback.NestedCallback 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);
}
Also used : SOAPService(org.apache.nested_callback.SOAPService) NestedCallback(org.apache.nested_callback.NestedCallback) EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) ServerPortType(org.apache.nested_callback.ServerPortType) URL(java.net.URL) Source(javax.xml.transform.Source) Test(org.junit.Test)

Aggregations

URL (java.net.URL)1 Source (javax.xml.transform.Source)1 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)1 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)1 NestedCallback (org.apache.nested_callback.NestedCallback)1 SOAPService (org.apache.nested_callback.SOAPService)1 ServerPortType (org.apache.nested_callback.ServerPortType)1 Test (org.junit.Test)1