Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The request soap xml can be logged easily by an custom In interceptor. Say, we have an interceptor named "wsLoggingInInterceptor", So in the context file it will be like the following :</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="wsLoggingInInterceptor" class="org.jinouts.webservice.logging.WSLoggingInInterceptor"/&gt; &lt;cxf:bus&gt; &lt;cxf:inInterceptors&gt; &lt;ref bean="loggingInInterceptor"/&gt; &lt;ref bean="wsLoggingInInterceptor"/&gt; &lt;/cxf:inInterceptors&gt; &lt;cxf:outInterceptors&gt; &lt;ref bean="logOutInterceptor"/&gt; &lt;/cxf:outInterceptors&gt; &lt;/cxf:bus&gt; </code></pre> <p>In the class we can get the request xml as follows:</p> <pre><code>public class WSLoggingInInterceptor extends AbstractSoapInterceptor { public WSLoggingInInterceptor () { super(Phase.RECEIVE); } @Override public void handleMessage ( SoapMessage message ) throws Fault { //get the remote address HttpServletRequest httpRequest = (HttpServletRequest) message.get ( AbstractHTTPDestination.HTTP_REQUEST ); System.out.println ("Request From the address : " + httpRequest.getRemoteAddr ( ) ); try { // now get the request xml InputStream is = message.getContent ( InputStream.class ); CachedOutputStream os = new CachedOutputStream ( ); IOUtils.copy ( is, os ); os.flush ( ); message.setContent ( InputStream.class, os.getInputStream ( ) ); is.close ( ); System.out.println ("The request is: " + IOUtils.toString ( os.getInputStream ( ) )); os.close ( ); } catch ( Exception ex ) { ex.printStackTrace ( ); } } } </code></pre> <p>Look, here I have also log the address from where the request is coming. You can also get some more information from the "HttpServletRequest" object. you can have more from : <a href="http://cxf.apache.org/docs/interceptors.html" rel="nofollow noreferrer">http://cxf.apache.org/docs/interceptors.html</a></p> <p>To log response xml you can have a look at <a href="https://stackoverflow.com/questions/6438178/cxf-outgoing-interceptor-get-soap-response-body-that-is-always-null/10501704#10501704">this thread</a></p>
    singulars
    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