return;
}
targetConfiguration.getWorkerPool().execute(new Runnable() {
public void run() {
MessageReceiver mr = mc.getAxisOperation().getMessageReceiver();
try {
AxisFault axisFault = (exceptionToRaise != null ?
new AxisFault(errorMessage, exceptionToRaise) :
new AxisFault(errorMessage));
MessageContext faultMessageContext =
MessageContextBuilder.createFaultMessageContext(mc, axisFault);
SOAPEnvelope envelope = faultMessageContext.getEnvelope();
if (log.isDebugEnabled()) {
log.debug("Sending Fault for Request with Message ID : "
+ mc.getMessageID());
}
faultMessageContext.setTo(null);
faultMessageContext.removeProperty(RelayConstants.RELAY_PIPE);
// copy the important properties from the original message context
faultMessageContext.setProperty(RelayConstants.RELAY_SOURCE_CONNECTION,
mc.getProperty(RelayConstants.RELAY_SOURCE_CONNECTION));
faultMessageContext.setProperty(RelayConstants.RELAY_SOURCE_CONFIGURATION,
mc.getProperty(RelayConstants.RELAY_SOURCE_CONFIGURATION));
faultMessageContext.setServerSide(true);
faultMessageContext.setDoingREST(mc.isDoingREST());
faultMessageContext.setProperty(MessageContext.TRANSPORT_IN, mc
.getProperty(MessageContext.TRANSPORT_IN));
faultMessageContext.setTransportIn(mc.getTransportIn());
faultMessageContext.setTransportOut(mc.getTransportOut());
faultMessageContext.setAxisMessage(
mc.getOperationContext().getAxisOperation().getMessage(
WSDLConstants.MESSAGE_LABEL_IN_VALUE));
faultMessageContext.setOperationContext(mc.getOperationContext());
faultMessageContext.setConfigurationContext(mc.getConfigurationContext());
faultMessageContext.setTo(null);
faultMessageContext.setProperty(
RelayConstants.SENDING_FAULT, Boolean.TRUE);
faultMessageContext.setProperty(
RelayConstants.ERROR_MESSAGE, errorMessage);
if (errorCode != -1) {
faultMessageContext.setProperty(
RelayConstants.ERROR_CODE, getErrorCode(errorCode, state));
}
if (exceptionToRaise != null) {
faultMessageContext.setProperty(
RelayConstants.ERROR_DETAIL, exceptionToRaise.toString());
faultMessageContext.setProperty(
RelayConstants.ERROR_EXCEPTION, exceptionToRaise);
envelope.getBody().getFault().getDetail().setText(
exceptionToRaise.toString());
} else {
faultMessageContext.setProperty(
RelayConstants.ERROR_DETAIL, errorMessage);
envelope.getBody().getFault().getDetail().setText(errorMessage);
}
faultMessageContext.setProperty(RelayConstants.NO_ENTITY_BODY, true);
mr.receive(faultMessageContext);
} catch (AxisFault af) {
log.error("Unable to report back failure to the message receiver", af);
}
}