Manuel Darveau
Manuel Darveau

Reputation: 4635

Log axis2 client requests and responses

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.

Upvotes: 21

Views: 51861

Answers (5)

Abdul Gafoor
Abdul Gafoor

Reputation: 974

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

Upvotes: 4

Sankar K S
Sankar K S

Reputation: 406

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

Upvotes: 39

Buminda
Buminda

Reputation: 621

-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

Upvotes: 0

Quartz
Quartz

Reputation: 1851

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);

Upvotes: 2

Mark O&#39;Connor
Mark O&#39;Connor

Reputation: 77971

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 :-)

Upvotes: 0

Related Questions