throws WebServiceException
{
boolean foundBody = false;
try {
XMLStreamReaderImpl reader = new XMLStreamReaderImpl(in);
// skip the Envelope
reader.nextTag();
if (reader.getEventType() != reader.START_ELEMENT ||
! "Envelope".equals(reader.getLocalName())) {
throw new WebServiceException(L.l("Invalid response from server: No Envelope found"));
}
// find the body
while (reader.hasNext()) {
reader.next();
if (reader.getEventType() == reader.START_ELEMENT &&
"Body".equals(reader.getLocalName())) {
// Copy the body contents to a StreamDataHandler
reader.nextTag();
XMLStreamWriterImpl xmlWriter = new XMLStreamWriterImpl(out, false);
StaxUtil.copyReaderToWriter(reader, xmlWriter);