1
votes

I did a lot of search but I was not able in finding what I need

I'm pretty new to Axis2; I'm using Axis2 version 1.6.2

I wrote my client by using axis2 maven plugin

All works pretty good

Now what I need is to log the request and response messages

I'm using logback; till now what I did is to configure logback in order to log the content of httpclient.wire packages. Request and reponse are logged but not in a very useful way. An Example id the following one

2016-04-13 15:37:29,614 8214 [main] DEBUG httpclient.wire.content - >> "36b[\r][\n]"
2016-04-13 15:37:29,616 8216 [main] DEBUG httpclient.wire.content - >> "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>SOAP MESSAGE CONTENT</soapenv:Body></soapenv:Envelope>"
2016-04-13 15:37:29,616 8216 [main] DEBUG httpclient.wire.content - >> "[\r][\n]"
2016-04-13 15:37:29,616 8216 [main] DEBUG httpclient.wire.content - >> "0"
2016-04-13 15:37:29,616 8216 [main] DEBUG httpclient.wire.content - >> "[\r][\n]"
2016-04-13 15:37:29,617 8217 [main] DEBUG httpclient.wire.content - >> "[\r][\n]"

What I wish is something similar to Spring WS logging where it logs the SOAP response and SOAP request in a comfortable way As far as I understood what I can do is to write a custom logging handler and a custom module and configure my client to user my logging handler What I'm not able in doing is to configure the client in order it uses my own Login Handler and Login Module

Is there any guide and/or example to follow?

Thank you

Abgelo

1

1 Answers

1
votes

I am not sure if this is the exact thing you are looking for, and even if you need this now. But anyone looking to get he raw xml string from Axis2, you can use the following code.

    OMElement  ele= someElementObject.getOMElement(SomeElementObject.MY_QNAME, OMAbstractFactory.getOMFactory());

    String xmlString= ele.toStringWithConsume();

where someElementObject is the xml tag pojo generated by Axis2 wsdl import wizard.

To parse a string xml to Axis2 object, use the following code.

SomeElementObject obj=SomeElementObject.Factory.parse(SOME_XML_STREAM);