@Override public Source respond(SoapOperation invokedOperation, SoapMessage message) { Exchange exchange = new DefaultExchange(getCamelContext(), ExchangePattern.InOut); Document messageDocument = message.getDocument(); String requestBody = envelopeWrapper.unwrap(messageDocument, getCamelContext()); exchange.getIn().setBody(requestBody); exchange.getIn().setHeader(OPERATION, invokedOperation.getOperationName()); try { getProcessor().process(exchange); if (exchange.getException() != null) { throw exchange.getException(); } Message responseMessage = exchange.getOut(Message.class); if (responseMessage != null) { String responseBody = responseMessage.getBody(String.class); return envelopeWrapper.wrapToSource(responseBody, getCamelContext()); } else { throw new IllegalArgumentException( "Could not find output message, exchange: " + exchange); } } catch (Exception ex) { throw new SoapServerException(ex); } }