I've a simple little servlet, basically:
void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
JAXBContext jaxb = myContext.getXMLContext().getSearchparamContext();
SearchParams params = null;
try {
Unmarshaller um = jaxb.createUnmarshaller();
um.setSchema(myContext.getXMLContext().getSearchParamsSchema());
JAXBElement<SearchParams> je = (JAXBElement<SearchParams>) um.unmarshal(request.getInputStream());
params = je.getValue();
} catch (JAXBException e) {
logger.log(Level.WARNING,"Error parsing xml from user "+ request.getRemoteUser(),e);
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
}
...
Is there any way I can get hold of the original XML here, if parsing fails - mostly for tracing purposes. Or should I just save to a file and unmarshal from that ?