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);
}
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);
}
Aggregations