final Message inMessage) {
String namespaceURI = inMAPs.getNamespaceURI();
if (!retrievePartialResponseSent(inMessage)) {
storePartialResponseSent(inMessage);
Exchange exchange = inMessage.getExchange();
Message fullResponse = exchange.getOutMessage();
Message partialResponse = createMessage(exchange);
ensurePartialResponseMAPs(partialResponse, namespaceURI);
// ensure the inbound MAPs are available in the partial response
// message (used to determine relatesTo etc.)
propogateReceivedMAPs(inMAPs, partialResponse);
partialResponse.put(Message.PARTIAL_RESPONSE_MESSAGE, Boolean.TRUE);
Destination target = inMessage.getDestination();
if (target == null) {
return;
}
try {
exchange.setOutMessage(partialResponse);
Conduit backChannel = target.getBackChannel(inMessage,
partialResponse,
reference);
if (backChannel != null) {
// set up interceptor chains and send message
InterceptorChain chain =
fullResponse != null
? fullResponse.getInterceptorChain()
: OutgoingChainInterceptor.getOutInterceptorChain(exchange);
partialResponse.setInterceptorChain(chain);
exchange.put(ConduitSelector.class,
new PreexistingConduitSelector(backChannel,
exchange.get(Endpoint.class)));
if (chain != null && !chain.doIntercept(partialResponse)
&& partialResponse.getContent(Exception.class) != null) {
if (partialResponse.getContent(Exception.class) instanceof Fault) {
throw (Fault)partialResponse.getContent(Exception.class);
} else {
throw new Fault(partialResponse.getContent(Exception.class));
}
}
if (chain != null) {
chain.reset();
}
exchange.put(ConduitSelector.class, new NullConduitSelector());
if (fullResponse != null) {
exchange.setOutMessage(fullResponse);
} else {
fullResponse = createMessage(exchange);
exchange.setOutMessage(fullResponse);
}
if (retrieveAsyncPostResponseDispatch(inMessage)) {
//need to suck in all the data from the input stream as
//the transport might discard any data on the stream when this