I do this to retrieve the request and response to/from my service:
final InputStream inputStream =
message.getExchange().getInMessage().getContent( InputStream.class );
inputStream.reset();
CacheAndWriteOutputStream cachedOutputStream =
(CacheAndWriteOutputStream)
message.getExchange().getOutMessage().getContent( OutputStream.class
);
this used to work - but somewhere in the line it started to fail with:
java.lang.ClassCastException:
org.apache.cxf.transport.http.AbstractHTTPDestination$WrappedOutputStream
incompatible with org.apache.cxf.io.CacheAndWriteOutputStream
at xxx.MyInterceptor.handleMessage
AbstractHTTPDestination$WrappedOutputStream is not available outside the class.
AbstractWrappedOutputStream does not provide a getInputStream() method.
Please advice me how to obtain the requests/responses either as a
stream or as a String.
Is my current approach OK?
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen