AJ
I would borrow getStringXML method from
org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest
/**
* Util method to convert the pullstream to a string
*
* @param reader
* @return
*/
private String getStringXML(javax.xml.stream.XMLStreamReader reader) throws
XMLStreamException {
//the returned pullparser starts at an Element rather than the start
//document event. This is somewhat disturbing but since an ADBBean
//denotes an XMLFragment, it is justifiable to keep the current event
//at the Start-element rather than the start document
//What it boils down to is that we need to wrap the reader in a
//stream wrapper to get a fake start-document event
StreamingOMSerializer ser = new StreamingOMSerializer();
ByteArrayOutputStream byteArrayOutputStream = new
ByteArrayOutputStream();
javax.xml.stream.XMLStreamWriter writer =
StAXUtils.createXMLStreamWriter(byteArrayOutputStream);
//currently puts ALL content of XMLStreamReader to disk in XML format
//filter what reader gives you to a new filtered reader and use filtered reader
in new StreamWrapper
ser.serialize(
new StreamWrapper(reader),
writer);
writer.flush();
//after flush ...should be on disk now
return byteArrayOutputStream.toString();
}
Martin
______________________________________________
From: [email protected]
To: [email protected]
Subject: Save messages exchanged via SOAP APIs
Date: Fri, 19 Dec 2014 00:01:47 +0530
Hi, Is there a way we can save messages exchanged via SOAP APIs as XML files in
the filesystem with a custom name?Please advice, ThanksAJ