Log axis2 client requests and responses
Asked Answered
S

5

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.

Saffian answered 26/3, 2010 at 15:14 Comment(2)
doesn't work for me too. probably it was true to earlier versions (i.e. axis v1)Introduction
developervisits.wordpress.com/2017/06/20/…Buskus
S
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

Shoifet answered 13/6, 2010 at 22:21 Comment(3)
Sankar: The name of my hero today.Jasperjaspers
To run it in Eclipse, write those parameters in the Debug configurations/Run configurations in VM argumentsAdrienadriena
If you are already using log4j logger: log4j.logger.org.apache.commons.httpclient=debug log4j.logger.httpclient.wire=debugOrlena
T
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
Trespass answered 29/11, 2016 at 17:4 Comment(0)
S
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);
Shoemaker answered 17/11, 2010 at 18:59 Comment(0)
D
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 :-)

Differentiation answered 30/3, 2010 at 2:15 Comment(2)
Thanks you I'm looking for client logging.Saffian
As mentioned by Manuel, this is applicable for the server side onlyIntroduction
S
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

Sepulchral answered 1/11, 2013 at 11:19 Comment(3)
Duplicate of the 2 years old answerSaffian
Not quite. It includes the httpclient.wire pattern, which logs the wire data.Scene
@Scott: the pattern you speak of is included in the 2 (now 8) year old answerSpenserian

© 2022 - 2024 — McMap. All rights reserved.