@Override
protected Object _getBOFromReader(XMLStreamReader reader, Object busContext)
throws XMLStreamException, WebServiceException {
// Get the JAXBBlockContext. All of the necessry information is recorded on it
JAXBBlockContext ctx = (JAXBBlockContext) busContext;
try {
// TODO Re-evaluate Unmarshall construction w/ MTOM
Unmarshaller u = JAXBUtils.getJAXBUnmarshaller(ctx.getJAXBContext());
if (DEBUG_ENABLED) {
log.debug("Adding JAXBAttachmentUnmarshaller to Unmarshaller");
}
Message msg = getParent();
JAXBAttachmentUnmarshaller aum = new JAXBAttachmentUnmarshaller(msg);
u.setAttachmentUnmarshaller(aum);
Object jaxb = null;
// Unmarshal into the business object.
if (ctx.getProcessType() == null) {
jaxb = unmarshalByElement(u, reader); // preferred and always used for
// style=document
} else {
jaxb =
unmarshalByType(u,
reader,
ctx.getProcessType(),
ctx.isxmlList(),
ctx.getConstructionType());
}
// Successfully unmarshalled the object
JAXBUtils.releaseJAXBUnmarshaller(ctx.getJAXBContext(), u);
// Don't close the reader. The reader is owned by the caller, and it
// may contain other xml instance data (other than this JAXB object)
// reader.close();
return jaxb;
} catch (JAXBException je) {
if (DEBUG_ENABLED) {
try {
log.debug("JAXBContext for unmarshal failure:" + ctx.getJAXBContext());
} catch (Exception e) {
}
}
throw ExceptionFactory.makeWebServiceException(je);
}