if (request.getAttachment() != null &&
request.getAttachment() instanceof Axis2HttpRequest) {
Axis2HttpRequest axis2Request = (Axis2HttpRequest) request.getAttachment();
MessageContext mc = axis2Request.getMsgContext();
MessageReceiver mr = mc.getAxisOperation().getMessageReceiver();
try {
// this fault is NOT caused by the endpoint while processing. so we have to
// inform that this is a sending error (e.g. endpoint failure) and handle it
// differently at the message receiver.
Exception exception = request.getException();
MessageContext nioFaultMessageContext =
MessageContextBuilder.createFaultMessageContext(
/** this is not a mistake I do NOT want getMessage()*/
mc, new AxisFault(exception.toString(), exception));
nioFaultMessageContext.setProperty(NhttpConstants.SENDING_FAULT, Boolean.TRUE);
mr.receive(nioFaultMessageContext);
} catch (AxisFault af) {
log.error("Unable to report back failure to the message receiver", af);
}
}