Hi...
I am trying to convert a POJO with 3 simple fields (of type String, Enum
and Object) into an AXIOM OMElement, using Axis2 1.6.1.
The POJO serialization code, as suggested by related Axis2 sample code, is
as follows:
public OMElement toXML()
{
XMLStreamReader reader = BeanUtil.getPullParser(this);
StreamWrapper parser = new StreamWrapper(reader);
StAXOMBuilder stAXOMBuilder = (StAXOMBuilder)OMXMLBuilderFactory.
createStAXOMBuilder(
OMAbstractFactory.getOMFactory(), parser);
return stAXOMBuilder.getDocumentElement();
}
Running the above code results in the Enum field and some of the Object
fields (e.g., Boolean objects) being converted to XML without a value. For
instance, if the POJO class is called TestField, the output produced by
calling toXML().toString() is
<TestField><name>boolean</name><type /><value /></TestField>
(The full code of the TestField class, plus more test output, can be found
here <http://stackoverflow.com/questions/8167674/axis2-axiom-serialization>
.)
Any clues?
Thanks!