Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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);
like image 534
Madhu CM Avatar asked Nov 02 '10 05:11

Madhu CM


People also ask

What is the Axis2 in XML?

The main file in all this is axis2. xml, which controls how the application deals with received messages. It defines message receivers and transport receivers, as well as defining transport senders and determining which modules are active.

What is Axis2 used for?

Apache Axis2 is a SOAP processing engine and its main function is to deliver incoming SOAP messages into target applications, and in this context application is a Web service. This tutorial provides step by step guidance on how to create your first Hello World application.

What is OMElement Axis2?

(An OMElement is how the AXIs2 Object Model (AXIOM) represents an XML element.) Create the service descriptor, services. xml, which defines the class to be used by the service and the appropriate message receivers.


1 Answers

Just call yourObject.toString() on OMElement

like image 195
resorcher Avatar answered Oct 06 '22 09:10

resorcher