21

I would like to log all requests/responses made by an axis2 client. I tried to create a file called client-config.wsdd as describer in http://code.google.com/support/bin/answer.py?hl=en&answer=15137 but without success (I don't get a log file).

Requests are made over https and I am not sure if it matters. I tried

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

and

<transport name="https" pivot="java:org.apache.axis.transport.http.HTTPSender"/>

without success.

Manuel Darveau
  • 4,585
  • 5
  • 26
  • 36
  • doesn't work for me too. probably it was true to earlier versions (i.e. axis v1) – maayank Apr 13 '10 at 07:39
  • https://developervisits.wordpress.com/2017/06/20/apache-axis-logging-of-soap-requestresponse-programmatically/ – Rajeev Sep 16 '18 at 12:36

5 Answers5

39

For Axis2-client side logging for SOAP messages, just use the following JVM arguments while running your standalone client or include this VM args in your Appln. Server start script,

JAVA_OPTS=-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -Dorg.apache.commons.logging.simplelog.showdatetime=true -Dorg.apache.commons.logging.simplelog.log.httpclient.wire=debug -Dorg.apache.commons.logging.simplelog.log.org.apache.commons.httpclient=debug

C:\java %JAVA_OPTS% YourClientAppln.java

Cheers, Sankar

Jens
  • 67,715
  • 15
  • 98
  • 113
Sankar K S
  • 406
  • 4
  • 3
4

If you add the below lines to your log4j.properties file, you will need not to pass any VM or JVM parameters.

#Axis2
log4j.appender.AxisLogFile=org.apache.log4j.RollingFileAppender
log4j.appender.AxisLogFile.File=${catalina.base}/logs/Axis-client.log
log4j.appender.AxisLogFile.layout=org.apache.log4j.PatternLayout
log4j.appender.AxisLogFile.layout.ConversionPattern=%d{ISO8601} [%X{UUID}] %5p %t %c{1} - %m%n
log4j.logger.httpclient.wire=DEBUG,AxisLogFile
Dudi Boy
  • 4,551
  • 1
  • 15
  • 30
Abdul Gafoor
  • 913
  • 10
  • 12
2

I know it's a bit verbose, but here's how we solved it:

SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
OMElement requestElement = request.getOMElement(RegisterIntegrationAgent.MY_QNAME, factory);
LOGGER.debug(requestElement);
Quartz
  • 1,731
  • 1
  • 14
  • 17
0

-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -Dorg.apache.commons.logging.simplelog.showdatetime=true -Dorg.apache.commons.logging.simplelog.log.httpclient.wire=debug -Dorg.apache.commons.logging.simplelog.log.org.apache.commons.httpclient=debug

This worked

Buminda
  • 611
  • 8
  • 15
0

I normally just log the body of the SOAP message, passed to my service class.

public OMElement myOperation(OMElement request) throws AxisFault {

    log.debug("Request: {}", request);

    ..

    log.debug("Response: {}", response);

    return response
}

Low tech but works for me :-)

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185