This is probably not going to work very well or very easily without a bunch of code. Stax pretty much consumes things as it does it's work. Thus, once you read an event, if you don't save it in a way that you can replay it, this will cause problems.
The only way I can really think this is going to work this way would be to convert the XmlStreamReader to an XmlEventReader. Read the event off, but record them in a List of events. Then write a custom XmlStreamReader that would first read from those saved events, and when they are consumed, revert back to reading from the original stream. Definitely complex. Another option: could you just use the parsed JAXB objects? Basically, put your interceptor in the USER_LOGICAL phase and get the contents list from the message and work with the data that was parsed into the objects. Dan On Friday 22 August 2008 3:40:52 pm rcohen16 wrote: > I'm trying to create an Interceptor that does some custom authentication by > reading credentials from the SOAP body. I want to avoid using SAAJ for > performance reasons since my payload may be rather large. I figured it > makes sense to use STaX to read only the content I need...The problem is, I > can't figure out how to use STaX in an Interceptor without disturbing other > Interceptors. I tried adding an Interceptor in the POST_PROTOCOL phase that > uses the XMLStreamReader from message.getContent(XMLStreamReader.class). > However, it I call next() on it, an Interceptor further down the chain > throws an error. Then I tried creating a new XMLStreamReader using the > InputStream from message.getContent(InputStream.class), but this stream is > already at EOF since a previous Interceptor already read it. > > Any suggestions on how I can create or access an existing XMLStreamReader > in my Interceptor without impacting other Interceptors? > > Thanks! -- Daniel Kulp [EMAIL PROTECTED] http://www.dankulp.com/blog
