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; }
@Override public NormalizedMessage invoke(InOut mex) throws MessagingException { try { DynamicService<T> service = new DynamicService<T>(_service); OMElement payload = OMUtils.toOM(mex.getInMessage().getContent()); OMElement response = service.invoke(mex.getOperation().getLocalPart(), payload); NormalizedMessage nresponse = null; if (response != null) { nresponse = mex.createMessage(); nresponse.setContent(new DOMSource(OMUtils.toDOM(response))); } return nresponse; } catch (Exception e) { throw new RuntimeException(e); } }
private void outResponse(MyRoleMessageExchange mex, javax.jbi.messaging.MessageExchange jbiMex) throws MessagingException { InOut inout = (InOut) jbiMex; try { NormalizedMessage nmsg = inout.createMessage(); String mapperName = mex.getProperty(Mapper.class.getName()); Mapper mapper = _ode.getMapper(mapperName); if (mapper == null) { String errmsg = "Message-mapper " + mapperName + " used in ODE MEX " + mex.getMessageExchangeId() + " is no longer available."; __log.error(errmsg); throw new MessageTranslationException(errmsg); } mapper.toNMS(nmsg, mex.getResponse(), mex.getOperation().getOutput().getMessage(), null); inout.setOutMessage(nmsg); } catch (MessageTranslationException e) { __log.error("Error translating ODE message " + mex.getResponse() + " to NMS format!", e); setError(jbiMex, e); } }
exchange.setFault(fault); } else { NormalizedMessage msg = exchange.createMessage(); soapHelper.getJBIMarshaler().toNMS(msg, soap); ((InOut) exchange).setOutMessage(msg);
/** * 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; } }
} else { final InOut inout = (InOut) jbiMex; NormalizedMessage nmsg = inout.createMessage(); mapper.toNMS(nmsg, odeMex.getRequest(), odeMex.getOperation().getInput().getMessage(), null); inout.setInMessage(nmsg);
NormalizedMessage in, QName service) throws MessagingException { NormalizedMessage msg = exchange.createMessage(); getMessageTransformer().transform(exchange, in, msg); exchange.setMessage(msg, "in");