It turns out that wrapping the input stream into StreamSource
is causing the problem. After dropping it your code becomes:
JAXBContext jaxbContext = JAXBContext.newInstance(QueryRequest.class);
XMLInputFactory xif = XMLInputFactory.newInstance();
xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, false);
InputStream source = new ByteArrayInputStream(queryRequestXml.getBytes());
XMLStreamReader xsr = xif.createXMLStreamReader(source);
And it should work now!