Search in sources :

Example 1 with ClientProviderHandler

use of org.talend.esb.mep.requestcallback.sample.internal.ClientProviderHandler in project tesb-rt-se by Talend.

the class RequestCallbackJmsTest method subTestServiceCall.

private void subTestServiceCall() throws Exception {
    // server.start();
    final Service service = Service.create(getClass().getResource(wsdlLocation), serviceName);
    service.addPort(portName, endpointInfo.getBinding().getBindingId(), endpointInfo.getAddress());
    // 1. Register a local callback endpoint on the client side
    final ClientProviderHandler callbackHandler = new ClientProviderHandler(errorTransfer, messageTransfer, callbackMap);
    final Endpoint ep = CallContext.createCallbackEndpoint(callbackHandler, wsdlLocation);
    callbackEndpoint = ep;
    JmsUriConfigurator cConfigurator = JmsUriConfigurator.create(ep);
    ep.publish(cConfigurator.getJmsAddress());
    // 2. Create a client
    final Dispatch<StreamSource> dispatcher = service.createDispatch(portName, StreamSource.class, Service.Mode.PAYLOAD);
    CallContext.setupDispatch(dispatcher, ep);
    JmsUriConfigurator configurator = JmsUriConfigurator.create(dispatcher);
    configurator.configureDispatch(dispatcher);
    if (mep == REQUEST_CALLBACK_ENFORCED) {
        final QName opName = new QName(serviceName.getNamespaceURI(), operation);
        CallContext.enforceOperation(opName, dispatcher);
    }
    // 3. Invoke the service operation
    final StreamSource request = new StreamSource(getClass().getResourceAsStream(requestLocation));
    dispatcher.invokeOneWay(request);
    assertTrue(messageTransfer.take() != null);
    sleep(1);
    checkError(false);
}
Also used : Endpoint(javax.xml.ws.Endpoint) JmsUriConfigurator(org.talend.esb.mep.requestcallback.beans.JmsUriConfigurator) QName(javax.xml.namespace.QName) StreamSource(javax.xml.transform.stream.StreamSource) Service(javax.xml.ws.Service) ClientProviderHandler(org.talend.esb.mep.requestcallback.sample.internal.ClientProviderHandler)

Example 2 with ClientProviderHandler

use of org.talend.esb.mep.requestcallback.sample.internal.ClientProviderHandler in project tesb-rt-se by Talend.

the class RequestCallbackTest method subTestServiceCall.

private void subTestServiceCall() throws Exception {
    // server.start();
    final Service service = Service.create(getClass().getResource(wsdlLocation), SERVICE_NAME);
    service.addPort(PORT_NAME, endpointInfo.getBinding().getBindingId(), endpointInfo.getAddress());
    // 1. Register a local callback endpoint on the client side
    final ClientProviderHandler callbackHandler = new ClientProviderHandler(errorTransfer, messageTransfer, callbackMap);
    final Endpoint ep = CallContext.createCallbackEndpoint(callbackHandler, wsdlLocation);
    callbackEndpoint = ep;
    ep.publish(CLIENT_CALLBACK_ENDPOINT);
    // 2. Create a client
    final Dispatch<StreamSource> dispatcher = service.createDispatch(PORT_NAME, StreamSource.class, Service.Mode.PAYLOAD);
    CallContext.setupDispatch(dispatcher, ep);
    if (mep == REQUEST_CALLBACK_ENFORCED) {
        final QName opName = new QName(SERVICE_NAMESPACE, operation);
        CallContext.enforceOperation(opName, dispatcher);
    }
    // 3. Invoke the service operation
    final StreamSource request = new StreamSource(getClass().getResourceAsStream(requestLocation));
    dispatcher.invokeOneWay(request);
    assertTrue(messageTransfer.take() != null);
    sleep(1);
    checkError(false);
}
Also used : Endpoint(javax.xml.ws.Endpoint) QName(javax.xml.namespace.QName) StreamSource(javax.xml.transform.stream.StreamSource) Service(javax.xml.ws.Service) ClientProviderHandler(org.talend.esb.mep.requestcallback.sample.internal.ClientProviderHandler)

Aggregations

QName (javax.xml.namespace.QName)2 StreamSource (javax.xml.transform.stream.StreamSource)2 Endpoint (javax.xml.ws.Endpoint)2 Service (javax.xml.ws.Service)2 ClientProviderHandler (org.talend.esb.mep.requestcallback.sample.internal.ClientProviderHandler)2 JmsUriConfigurator (org.talend.esb.mep.requestcallback.beans.JmsUriConfigurator)1