简体   繁体   中英

Deserialize SOAP Body generated by AXIS2

I am currently logging the XML generated by AXIS2 client code in my DB. Now i need to resend that XML request from the log. I have the XML Content that will come inside "SOAPBody" tag.

I have tried to using BeanUtil deserialize method. and even Axis2 object.factory.parse method, both do not work.

I ended up doing the following. If anyone looking to get he raw xml string from Axis2, you can use the following code.

    OMElement  ele= someElementObject.getOMElement(SomeElementObject.MY_QNAME, OMAbstractFactory.getOMFactory());

    String xmlString= ele.toStringWithConsume();

where someElementObject is the xml tag pojo generated by Axis2 wsdl import wizard.

To parse a string xml to Axis2 object, use the following code.

SomeElementObject obj=SomeElementObject.Factory.parse(SOME_XML_STREAM);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM