Here's my problem. The software I'm using has a servlet that listens for XML feeds (XML posted via HTTP). As you can image, it is expecting the XML to adhere to a certain schema. Now...I have a little integration project where the XML that will be sent has a different structure. I want to add a filter to intercept the request and transform the XML into the format that the software expects before passing it along to the servlet.
Is there anyway to use HttpServletRequestWrapper to read the the data (using the request's BufferedReader), transform the XML and then put the new XML into wrapped request - essentially replacing the the original data (so that I don't have to muck with any of the servlet's code)??
I'm guessing I'm up the proverbial creek here, but thought someone on this forum with more brain cells and experience might have a slick trick up their sleeve.
I guess what I am struggling with is how do I replace the body of the request? I can call the getReader() method but how do I change/replace the character stream from the old XML to the new XML - meaning, how do I swap in a new character stream into the request's BufferedReader?
I don't want to have to touch the servlet code at all but the servlet simply calls the request's getReader() method and expects the XML to be in a certain format. I might be on the right creek, but I sure feel like I don't have a paddle...