try {
Class<?> theType = getActualType(type, genericType);
JAXBContext context = getJAXBContext(theType, genericType);
Unmarshaller unmarshaller = context.createUnmarshaller();
MappedXMLInputFactory factory = new MappedXMLInputFactory(namespaceMap);
XMLStreamReader xsw = factory.createXMLStreamReader(is);
Object response = null;
if (JAXBElement.class.isAssignableFrom(type)) {
response = unmarshaller.unmarshal(xsw, theType);
} else {
response = unmarshaller.unmarshal(xsw);