final Reader reader = new StringReader(contents) ;
if (logPackets)
{
SoapMessageLogging.appendThreadLog(contents) ;
}
final SoapMessage soapResponse ;
try
{
soapResponse = soapProcessor.process(messageContext,
messageResponseContext, action, reader) ;
}
finally
{
if (logPackets)
{
SoapMessageLogging.clearThreadLog() ;
}
}
response.setContentType(contentType + HttpUtils.HTTP_DEFAULT_CHARSET_PARAMETER) ;
if (soapResponse == null)
{
response.setStatus(HttpServletResponse.SC_ACCEPTED) ;
}
else
{
final String actionURI = soapResponse.getAction() ;
response.addHeader(HttpUtils.SOAP_ACTION_HEADER, '"' + actionURI + '"') ;
response.setStatus(soapResponse.isFault() ?
HttpServletResponse.SC_INTERNAL_SERVER_ERROR :
HttpServletResponse.SC_OK) ;
try
{
soapResponse.output(response.getWriter()) ;
}
catch (Throwable th)
{
throw new ServletException("Error sending response", th) ;
}