I'm pretty sure this is not the best way to do it, but it worked for me:

public class MyClass extends AbstractPhaseInterceptor< Message > {
        public MyClass () {
                super( Phase.PRE_STREAM );
                addAfter( AttachmentOutInterceptor.class.getName() );
        }

        @Override
        public void handleMessage( final Message message ) throws Fault {
                message.put( "disable.outputstream.optimization", Boolean.TRUE 
);
                final SimpleNsStreamWriter writer =
(SimpleNsStreamWriter)StaxUtils.createXMLStreamWriter( message.getContent(
OutputStream.class ) );
                message.setContent( XMLStreamWriter.class, new 
DelegatingXMLStreamWriter(
writer ) {
                        @Override
                        public void writeCharacters( final String text ) throws
XMLStreamException {
                                System.out.println( "text -> " + text );
                                writer.writeRaw( text );
                        }
                } );
        }



--
View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-encoding-embedded-XML-tp5738466p5738469.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to