}
}
}
}
MessageFormatter messageFormatter = MessageProcessorSelector.getMessageFormatter(msgContext);
if (messageFormatter == null) throw new AxisFault("No MessageFormatter in MessageContext");
// Once we get to this point, exceptions should NOT be turned into faults and sent,
// because we're already sending! So catch everything and log it, but don't pass
// upwards.
try {
transportInfo.setContentType(
messageFormatter.getContentType(msgContext, format, findSOAPAction(msgContext)));
Object gzip = msgContext.getOptions().getProperty(HTTPConstants.MC_GZIP_RESPONSE);
if (gzip != null && JavaUtils.isTrueExplicitly(gzip)) {
if (servletBasedOutTransportInfo != null)
servletBasedOutTransportInfo.addHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
HTTPConstants.COMPRESSION_GZIP);
try {
out = new GZIPOutputStream(out);
out.write(messageFormatter.getBytes(msgContext, format));
((GZIPOutputStream) out).finish();
out.flush();
} catch (IOException e) {
throw new AxisFault("Could not compress response");
}
} else {
messageFormatter.writeTo(msgContext, format, out, false);
}
} catch (AxisFault axisFault) {
log.error(axisFault.getMessage(), axisFault);
throw axisFault;
}