You might want to see JAXBElementProvider class you can find marshal and unmarshal jaxb methods
And you can easily override the default JAXB provider by copying it make the changes and to register user defined provider. Here is the example from my app spring context file <jaxrs:server id="service" address="/"> <jaxrs:serviceBeans> <bean class="com.liquid.fulfiller.sample.server.CustomerService" /> </jaxrs:serviceBeans> <jaxrs:entityProviders> <bean class="com.liquid.fulfiller.jaxrs.JAXBElementProvider"/> </jaxrs:entityProviders> </jaxrs:server> Hope this help -Gopal Anthony Schexnaildre wrote: > > Hello group, > > I very much want to diddle the response xml on it's way out to add > attributes and other bits. Unfortunately I seem to be at a loss of how > to accomplish this even though it seems like it should be very easy. I > am using CXF 2.1.1, JAXRS and JAXB if that is of interest. > > I have written an Interceptor to test with modeled after what I think > is happening in the LoggingOutInterceptor, placed it in all different > locations on the interceptor chain to see what happens in the message > and I am not finding too much. > > If I iterate through message.getInterceptorChain() I get: > > org.apache.cxf.interceptor.MessageSenderInterceptor > org.apache.cxf.interceptor.LoggingOutInterceptor > org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor > com.mypackage.cxf.ContentsDumpInterceptor > org.apache.cxf.interceptor.MessageSenderInterceptor > $MessageSenderEndingInterceptor > > If I iterate through message.getContentFormats() I get: > > OutputStream > List > > The list is filled with a ResponseImpl as that is what I am returning > from the method invocation. > > If I try to print the OutputStream like the LoggingOutInterceptor does > nothing happens: > > public void handleMessage(Message message) throws Fault { > StringBuilder s = new StringBuilder(); > try { > CachedOutputStream cos = new > CacheAndWriteOutputStream(message.getContent(OutputStream.class)); > cos.writeCacheTo(s); > LOG.info("~~~~~~~~My Message: " + s.toString() ); > } catch (IOException e) { > e.printStackTrace(); > } > } > > Where does the XML live? How to I get at it? Please point me in the > right direction. This must be very simple. > > -Anthony > > > > -- View this message in context: http://www.nabble.com/Modify-Response-XML-tp18162638p18164257.html Sent from the cxf-user mailing list archive at Nabble.com.