// ensure properties, hence HTTP headers, are propagated both ways
final TransformerTemplate copyInboundToOutboundPropertiesTransformer = new TransformerTemplate(
new CopyInboundToOutboundPropertiesTransformerCallback());
final DefaultMessageProcessorChainBuilder proxyBuilder = new DefaultMessageProcessorChainBuilder();
proxyBuilder.chain(copyInboundToOutboundPropertiesTransformer);
proxyBuilder.chain(new ResponseMessageProcessorAdapter(copyInboundToOutboundPropertiesTransformer));
if (outboundEndpoint instanceof DynamicURIOutboundEndpoint)
{
// do not mess with endpoints that are already dynamic