try {
MimeHeaders headers = getHeaders(req);
SOAPMessage request = msgFactory.createMessage(headers, req.getInputStream());
SOAPMessage reply = onMessage(request);
if (reply != null) {
if (reply.saveRequired()) {
reply.saveChanges();
}
resp.setStatus(!reply.getSOAPBody().hasFault() ? HttpServletResponse.SC_OK :
HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
putHeaders(reply.getMimeHeaders(), resp);