Monday, November 16, 2015

How to log Axis messages

If you use webservice calls in your system, the axis has very common 3rd party libraries to send and receive the messages: SOAP, XML, JSON whatever.

Sometimes desirable to see in the logs what kind of messages travel in your system.


Just create the following XML file, named: client-config.wsdd
Put the file to any resource folder. After a new deployment you will see the messages on the console.

I tried to log the messages to a log file, it was not working for me. But i did not want to spend more time with this analysis.

<?xml version="1.0" encoding="UTF-8"?>
<deployment name="defaultClientConfig" xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

   <handler name="log" type="java:org.apache.axis.handlers.LogHandler">
<parameter name="LogHandler.writeToConsole" value="true" />
   </handler>

   <globalConfiguration>
      <parameter name="disablePrettyXML" value="false" />
      <requestFlow>
         <handler type="log" />
      </requestFlow>
      <responseFlow>
         <handler type="log" />
      </responseFlow>
   </globalConfiguration>

   <transport name="http"  pivot="java:org.apache.axis.transport.http.HTTPSender" />
   <transport name="local" pivot="java:org.apache.axis.transport.local.LocalSender" />
   <transport name="java"  pivot="java:org.apache.axis.transport.java.JavaSender" />
</deployment>

No comments:

Post a Comment