So after hours or Googling out there in the web, I decided to get adventurous and program my own handler. Is much easier than expected.
I made a class that extends the abstract class BasicHandler (org.apache.axis.handlers.BasicHandler), and implements the invoke method loging the request or the response. Here is my class, which I have baptized as SOAPLogHandler :
package com.mypackage.axishandlers;
import org.apache.axis.AxisFault;
import org.apache.axis.MessageContext;
import org.apache.axis.handlers.BasicHandler;
import org.apache.log4j.Logger;
public class SOAPLogHandler extends BasicHandler {
private static Logger LOG= Logger.getLogger(SOAPLogHandler.class);
private static final long serialVersionUID = 1L;
@Override
public void invoke(MessageContext msgContext) throws AxisFault {
if(msgContext.getResponseMessage() != null && msgContext.getResponseMessage().getSOAPPart() != null) {
LOG.info(" Response = " + msgContext.getResponseMessage().getSOAPPartAsString());
} else {
if(msgContext.getRequestMessage() != null && msgContext.getRequestMessage().getSOAPPartAsString() != null) {
LOG.info(" Request = " + msgContext.getRequestMessage().getSOAPPartAsString());
}
}
} }
The idea is, to log first the request, and when processed, log the response. So, in the server-config.wsdd (or the wsdd file from your client if you are in the client side), we have to add a handler pointing to that class, and configure it to uses in the request/response chain:
1st add the handler
<handler name="log" type="java:com.mypackage.axishandlers.SOAPLogHandler"/>
2nd add the use of that handler to the request/response from the http transport (focus on the log handler)
<transport name="http">
<requestFlow>
<handler type="log"/>
<handler type="URLMapper"/>
<hand
answered 2012-09-28T10:54:03.553