if (bodyPrologue != null) {
writer.writeCharacters(bodyPrologue);
}
XMLStreamReaderToXMLStreamWriter conv = new XMLStreamReaderToXMLStreamWriter();
while(reader.getEventType() != XMLStreamConstants.END_DOCUMENT){
String name = reader.getLocalName();
String nsUri = reader.getNamespaceURI();
// After previous conv.bridge() call the cursor will be at END_ELEMENT.
// Check if its not soapenv:Body then move to next ELEMENT
if(reader.getEventType() == XMLStreamConstants.END_ELEMENT){
if (!isBodyElement(name, nsUri)){
// closing payload element: store epilogue for further signing, if applicable
// however if there more than one payloads exist - the last one is stored
String whiteSpaces = XMLStreamReaderUtil.nextWhiteSpaceContent(reader);
if (whiteSpaces != null) {
this.bodyEpilogue = whiteSpaces;
// write it to the message too
writer.writeCharacters(whiteSpaces);
}
} else {
// body closed > exit
break;
}
} else {
// payload opening element: copy payload to writer
conv.bridge(reader,writer);
}
}
XMLStreamReaderUtil.readRest(reader);
XMLStreamReaderUtil.close(reader);