public InOut createInOutExchange() throws MessagingException { InOut exchange = getExchangeFactory().createInOutExchange(); NormalizedMessage in = exchange.createMessage(); exchange.setInMessage(in); return exchange; }
public InOut createInOutExchange() throws MessagingException { InOut exchange = getExchangeFactory().createInOutExchange(); NormalizedMessage in = exchange.createMessage(); exchange.setInMessage(in); return exchange; }
/** * sends the given DOMSource as message to the given service (inOut) * * @param service * the service name to send the message to * @param source * the source to put in the in message content * @return the DOMSource of the out message or null * @throws MessagingException * on any messaging exception */ public MessageExchange sendRawInOutRequest(QName service, Source source) throws MessagingException { InOut inOut = getChannel().createExchangeFactoryForService(service).createInOutExchange(); NormalizedMessage msg = inOut.createMessage(); msg.setContent(source); inOut.setInMessage(msg); if (getChannel().sendSync(inOut)) { return inOut; } else { return null; } }
/** * sends the given DOMSource as message to the given service (inOut) * * @param service * the service name to send the message to * @param source * the source to put in the in message content * @return the DOMSource of the out message or null * @throws MessagingException * on any messaging exception */ public Source sendRequest(QName service, Source source) throws MessagingException { InOut inOut = getChannel().createExchangeFactoryForService(service).createInOutExchange(); NormalizedMessage msg = inOut.createMessage(); msg.setContent(source); inOut.setInMessage(msg); if (getChannel().sendSync(inOut)) { try { Source result = sourceTransformer.toDOMSource(inOut.getOutMessage().getContent()); done(inOut); return result; } catch (Exception ex) { ex.printStackTrace(); return null; } } else { return null; } }
NormalizedMessage nmsg = inout.createMessage(); mapper.toNMS(nmsg, odeMex.getRequest(), odeMex.getOperation().getInput().getMessage(), null); inout.setInMessage(nmsg); copyMexProperties(jbiMex, odeMex); _ode._scheduler.registerSynchronizer(new Scheduler.Synchronizer() {
public void onMessageExchange(MessageExchange exchange) throws MessagingException { // Skip done exchanges if (exchange.getStatus() == ExchangeStatus.DONE) { return; // Handle error exchanges } else if (exchange.getStatus() == ExchangeStatus.ERROR) { return; } // lets create an endpoint DeliveryChannel deliveryChannel = getDeliveryChannel(); MessageExchangeFactory rpcFactory = deliveryChannel.createExchangeFactory(requestResponseEndpoint); InOut rpc = rpcFactory.createInOutExchange(); rpc.setInMessage(exchange.getMessage("in")); boolean answer = deliveryChannel.sendSync(rpc); MessageExchangeFactory outputFactory = deliveryChannel.createExchangeFactory(outputEndpoint); InOnly inOnly = outputFactory.createInOnlyExchange(); if (answer) { inOnly.setInMessage(rpc.getOutMessage()); deliveryChannel.send(inOnly); done(exchange); } else if (!(exchange instanceof InOnly)) { inOnly.setError(rpc.getError()); Fault fault = rpc.getFault(); fail(exchange, fault); } else { // terminate the exchange done(exchange); } done(rpc); }