Madhu CM
Madhu CM

Reputation: 2546

Axis2 object to xml

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

Upvotes: 10

Views: 5771

Answers (1)

resorcher
resorcher

Reputation: 41

Just call yourObject.toString() on OMElement

Upvotes: 2

Related Questions