I have an Axis2 Object returned from my Java code. How can I convert that object to XML or output it as XML in the console? I know there is lots of 3rd party libraries available to serialize objects to XML - but how to do it with the Axis2?
Update: From this link I found the solution. One needs to get an OMElement
like this:
OMElement omElement = sampleElement1
.getOMElement(SampleElement1.MY_QNAME, OMAbstractFactory.getOMFactory());
String omElementString = omElement.toStringWithConsume();
System.out.println("XML String ==> " + omElementString);