Question: I have generated java clients uisng wsdl2java using axis2. My client programs can sucessfully connect to webservice. I want to log outgoing soap request to read soap message. 

Can someone direct me to an article expaining how can I log soap messages in Axis2.

Answer: 
you can additionally consider writing a custom axis module for logging - check <http://axis.apache.org/axis2/java/core/docs/modules.html> for more information
If you're using Axis2 Data Binding, then the automatically-generated classes for your web services will all be subclasses of ADBBean. You can use something like the following to convert an ADBBean to a string, then log the string.

```
public static String
writeADBBean(ADBBean aBean) throws XMLStreamException {
    if (null == aBean)
        return "null";
    OMElement omElement;
    try
    {
        // The preferred way of serializing objects generated by Axis2's
        // WSDL2JAVA involves methods that are named the same on every
        // class but that aren't inherited from any base class. So, use
        // reflection to find them.
        QName qname;
        try {
            Field qnameField = aBean.getClass().getField("MY_QNAME");
            qname = (QName)qnameField.get(aBean);
        } catch (Exception e) {
            // Some Axis2-generated objects don't have QNames. Supply
            // one based on the object's class.
            qname = new QName(aBean.getClass().getCanonicalName());
        }
        Method getOMElement = aBean.getClass().getMethod("getOMElement", QName.class, OMFactory.class);
        omElement = (OMElement)getOMElement.invoke(aBean, qname, OMAbstractFactory.getOMFactory());
    } catch (Exception e) {
        log.warn("Reflection failed for " + aBean.toString() + ": " + e.toString());
        throw new XMLStreamException("Cannot serialize " + aBean.toString(), e);
    } catch (NoClassDefFoundError e) {
        log.error("NoClassDefFoundError while serializing " + aBean.toString() + ": " + e.toString());
        throw new XMLStreamException("Cannot serialize " + aBean.toString(), e);
    }
    String serialized = omElement.toStringWithConsume();
    return serialized;
}

```