Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To get the response xml from the soap message, you can use the "CacheAndWriteOutputStream" and "CachedOutputStreamCallback". In the callback class you can get the message before closing the stream. Say, our out LoggingInterceptor is "wsLoggingOutInterceptor" which can be configured in the context file as follows :</p> <pre><code>&lt;bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor"/&gt; &lt;bean id="logOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/&gt; &lt;bean id="wsLoggingOutInterceptor" class="org.jinouts.webservice.logging.WSLoggingOutInterceptor"&gt;&lt;/bean&gt; &lt;cxf:bus&gt; &lt;cxf:inInterceptors&gt; &lt;ref bean="loggingInInterceptor"/&gt; &lt;/cxf:inInterceptors&gt; &lt;cxf:outInterceptors&gt; &lt;ref bean="logOutInterceptor"/&gt; &lt;ref bean="wsLoggingOutInterceptor"/&gt; &lt;/cxf:outInterceptors&gt; &lt;/cxf:bus&gt; </code></pre> <p>Note that, here we have also some default interceptor which is available with the CXF jars. Now in our own interceptor we can write in the following way to log the output response message or you can also edit here :</p> <pre><code>/** * @author asraf * asraf344@gmail.com */ public class WSLoggingOutInterceptor extends AbstractLoggingInterceptor { public WSLoggingOutInterceptor() { super(Phase.PRE_STREAM ); } @Override public void handleMessage ( Message message ) throws Fault { // TODO Auto-generated method stub OutputStream os = message.getContent ( OutputStream.class ); CacheAndWriteOutputStream cwos = new CacheAndWriteOutputStream ( os); message.setContent ( OutputStream.class, cwos ); cwos.registerCallback ( new LoggingOutCallBack ( ) ); } @Override protected Logger getLogger ( ) { // TODO Auto-generated method stub return null; } } class LoggingOutCallBack implements CachedOutputStreamCallback { @Override public void onClose ( CachedOutputStream cos ) { try { if ( cos != null ) { System.out.println ("Response XML in out Interceptor : " + IOUtils.toString ( cos.getInputStream ( ) )); } } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void onFlush ( CachedOutputStream arg0 ) { } } </code></pre> <p>Have a look at this site for more details : <a href="http://cxf.apache.org/docs/interceptors.html">http://cxf.apache.org/docs/interceptors.html</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload