Search in sources :

Example 1 with SOAPService

use of org.apache.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/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();
}
Also used : SOAPService(org.apache.callback.SOAPService) Endpoint(javax.xml.ws.Endpoint) ServerPortType(org.apache.callback.ServerPortType) URL(java.net.URL) EndpointReference(javax.xml.ws.EndpointReference) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) Test(org.junit.Test)

Example 2 with SOAPService

use of org.apache.callback.SOAPService in project cxf by apache.

the class Client method main.

public static void main(String[] args) throws Exception {
    Object implementor = new CallbackImpl();
    String address = "http://localhost:9005/CallbackContext/CallbackPort";
    Endpoint endpoint = Endpoint.publish(address, implementor);
    if (args.length == 0) {
        System.out.println("please specify wsdl");
        System.exit(1);
    }
    URL wsdlURL;
    File wsdlFile = new File(args[0]);
    if (wsdlFile.exists()) {
        wsdlURL = wsdlFile.toURI().toURL();
    } else {
        wsdlURL = new URL(args[0]);
    }
    SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
    ServerPortType port = ss.getSOAPPort();
    InputStream is = demo.callback.client.Client.class.getResourceAsStream("/callback_infoset.xml");
    Document doc = StaxUtils.read(is);
    Element referenceParameters = DOMUtils.findChildWithAtt(doc.getDocumentElement(), "wsa:ReferenceParameters", "name", "");
    W3CEndpointReference ref = (W3CEndpointReference) endpoint.getEndpointReference(referenceParameters);
    String resp = port.registerCallback(ref);
    System.out.println("Response from server: " + resp);
    System.exit(0);
}
Also used : SOAPService(org.apache.callback.SOAPService) InputStream(java.io.InputStream) Element(org.w3c.dom.Element) ServerPortType(org.apache.callback.ServerPortType) Document(org.w3c.dom.Document) URL(java.net.URL) Endpoint(javax.xml.ws.Endpoint) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) File(java.io.File)

Aggregations

URL (java.net.URL)2 Endpoint (javax.xml.ws.Endpoint)2 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)2 SOAPService (org.apache.callback.SOAPService)2 ServerPortType (org.apache.callback.ServerPortType)2 File (java.io.File)1 InputStream (java.io.InputStream)1 EndpointReference (javax.xml.ws.EndpointReference)1 Test (org.junit.Test)1 Document (org.w3c.dom.Document)1 Element (org.w3c.dom.Element)1