diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2018-01-18 08:51:12 +0100 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2018-01-18 08:51:12 +0100 |
commit | 7cb792c48aac3303f9ea2fcf2720d4cc39a868c2 (patch) | |
tree | 90b62c060cd60750464d5da877515b01aa435ee0 /moaSig | |
parent | a6570f5174563472cace5f3619779c8a18c407f3 (diff) | |
download | moa-sig-7cb792c48aac3303f9ea2fcf2720d4cc39a868c2.tar.gz moa-sig-7cb792c48aac3303f9ea2fcf2720d4cc39a868c2.tar.bz2 moa-sig-7cb792c48aac3303f9ea2fcf2720d4cc39a868c2.zip |
add trace output to log http headers into AxisHandler.java
Diffstat (limited to 'moaSig')
-rw-r--r-- | moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java index 9fa99b1..4ee4e07 100644 --- a/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java +++ b/moaSig/moa-sig/src/main/java/at/gv/egovernment/moa/spss/server/service/AxisHandler.java @@ -28,7 +28,9 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.security.cert.X509Certificate; +import java.util.Enumeration; import java.util.Iterator; import javax.servlet.http.HttpServletRequest; @@ -46,6 +48,8 @@ import org.apache.axis.utils.XMLUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; import at.gv.egovernment.moa.spss.MOASystemException; import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; @@ -127,6 +131,7 @@ public class AxisHandler extends BasicHandler { * An error occurred during processing of the request. */ private void handleRequest(MessageContext msgContext) throws AxisFault { + Message soapMessage = null; try { Logger.trace("---- Entering Axishandler"); // generate a unique transaction id and build the TransactionContext @@ -135,6 +140,17 @@ public class AxisHandler extends BasicHandler { X509Certificate[] clientCert = (X509Certificate[]) request.getAttribute(X509_CERTIFICATE_PROPERTY); + if (Logger.isTraceEnabled()) { + Enumeration<String> allHeaders = request.getHeaderNames(); + if (allHeaders != null) { + while(allHeaders.hasMoreElements()) { + String header = allHeaders.nextElement(); + Logger.trace("Header: " + header + " : " + request.getHeader(header)); + + } + } + } + // Configure Axis // AxisProperties.setProperty(AxisEngine.PROP_ENABLE_NAMESPACE_PREFIX_OPTIMIZATION,"false"); // AxisProperties.setProperty(AxisEngine.PROP_DOMULTIREFS,"false"); @@ -144,10 +160,10 @@ public class AxisHandler extends BasicHandler { // msgContext.setProperty(org.apache.axis. // AxisEngine.PROP_ENABLE_NAMESPACE_PREFIX_OPTIMIZATION,"false"); //AxisProperties.setProperty(AxisEngine.PROP_ATTACHMENT_IMPLEMENTATION, AxisEngine.DEFAULT_ATTACHMENT_IMPL); - Message soapMessage = msgContext.getCurrentMessage(); + soapMessage = msgContext.getCurrentMessage(); ConfigurationProvider configuration = ConfigurationProvider.getInstance(); - + new String(soapMessage.getSOAPPartAsBytes()); Element xmlRequest = null; // log.info(soapMessage.getSOAPPartAsString()); Element soapPart = DOMUtils @@ -257,6 +273,24 @@ public class AxisHandler extends BasicHandler { AxisFault fault = AxisFault.makeFault(se); fault.setFaultDetail(new Element[] { se.toErrorResponse() }); throw fault; + + } catch (SAXException t ) { + if (soapMessage != null && soapMessage.getSOAPPartAsBytes() != null) { + try { + Logger.debug("Req: " + new String(soapMessage.getSOAPPartAsBytes(), "UTF-8")); + } catch (UnsupportedEncodingException e1) { + e1.printStackTrace(); + } + + } + + t.printStackTrace(); + Logger.info(new LogMsg(t.getStackTrace())); + MOASystemException e = new MOASystemException("2900", null, t); + AxisFault fault = AxisFault.makeFault(e); + fault.setFaultDetail(new Element[] { e.toErrorResponse() }); + throw fault; + } catch (Throwable t) { t.printStackTrace(); Logger.info(new LogMsg(t.getStackTrace())); |