简体   繁体   中英

Logging malformed Axis2 requests

I'm using Axis2-1.6.2 in a highly modified Tomcat6 environment hosting a web service and need to log every incoming Axis2 web service request.

This is for a production environment and I want all requests (SOAP messages) to be logged into a log file.

For valid requests (valid request structure conform with the WSDL), this works fine, because I can log the request body after it has been parsed by Axis2. The problem is with malformed requests, which are declined by Axis2 and don't come through to my code.

I've tried a lot so far to log these wrong requests as well, but none of the proposed (easy) solutions worked. I basically just want to set a logback appender (SLF4J) or add some -Dparameter to the Java process to motivate Axis2 to log every incoming message into a file and couldn't believe that apparently there is no easy way to do that.

It seems to me that the only solution is to write a custom handler, which does the logging. However, this seems to be too much effort and customization for an established technology and an obvious use case. I do have guides how to do that like axis2 Log Response with Request and Java Example - Loghandler.java .

Isn't there an easier (more native) way?

For valid requests (valid request structure conform with the WSDL), this works fine, because I can log the request body after it has been parsed by Axis2. The problem is with malformed requests, which are declined by Axis2 and don't come through to my code.

This is because, after the request is dispatched to service, it will fail because it is not following the service definition..

AFAIK, only solution is, keep a custom handler before dispatching phase, to capture and log the requests. Whatever the logging mechanism will work after passing axis2 layer..But in your case, it will fail before that..So, try to keep a simple handler to log messages..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM