title: CXF interceptors not working
body: <p>I've created web service cxf client that simply sends soap message to given endpoint, and I have got some, I think, strange issue. 
  First of all, I don't know why I get a lot of debug logs, and second, more important issue is that interceptors aren't working. Nor mine or those from CXF framework. 
  I have created classes using wsimport from wsdl, so I suppose this issues are not related to them (I have done a lot of client-service applications and didn't have any problem with this tool).
  Here's my main class:</p>
  
  <pre><code>    System.setProperty("com.sun.net.httpserver.HttpServerProvider",
                 "org.mortbay.jetty.j2se6.JettyHttpServerProvider");
      JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
      factory.getOutInterceptors().add(new LoggingInInterceptor());
      factory.getInInterceptors().add(new LoggingOutInterceptor());
      factory.setAddress(ADDRESS);
      factory.setServiceClass(WebserviceInterface.class);
      factory.setUsername("usr");
      factory.setPassword("pass");
      Main main = new Main();
      main.operation = (WebserviceInterface) factory.create();
  
      WebServiceRequest request = main.generateRequest();
  
      main.operation.someWebServiceOperation(request);
  </code></pre>
  
  <p>Here I add default cxf interceptors but it didn't work so I've created my own interceptors:
  IN:</p>
  
  <pre><code>public class LoggingInInterceptor extends AbstractSoapInterceptor {
  
  private static final Logger LOG = Logger.getLogger(LoggingInInterceptor.class.getName());
  
  public LoggingInInterceptor () {
      super(Phase.RECEIVE);
  }
  
  @Override
  public void handleMessage(SoapMessage message) throws Fault {
      LOG.log(Level.INFO, "\n\n\n\nhandleMessage called\n\n\n\n");
      InputStream is = message.getContent(InputStream.class);
      CachedOutputStream os = new CachedOutputStream();
      try {
          IOUtils.copy(is, os);
          os.flush();
          message.setContent(InputStream.class, os.getInputStream());
          is.close();
          GregorianCalendar calendar = new GregorianCalendar();
          Date date = new Date();
          calendar.setTime(date); //gets current date and time
          XMLGregorianCalendar timestamp = DatatypeFactory
                                              .newInstance()
                                              .newXMLGregorianCalendar(calendar);
          System.out.println("Received at " + timestamp + ":\n" + XMLFormatter.format(IOUtils.toString(os.getInputStream())));//NOPMD
          System.out.println("----------------------------" + "\n\n");//NOPMD
      } catch (IOException e) {
          LOG.log(Level.WARNING, e.getMessage(), IOException.class);
      } catch (DocumentException e) {
          LOG.log(Level.WARNING, e.getMessage(), DocumentException.class);
      } catch (DatatypeConfigurationException e) {
          LOG.log(Level.WARNING, e.getMessage(), DatatypeConfigurationException.class);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>OUT:</p>
  
  <pre><code>public class LogginOutInterceptor extends LoggingOutInterceptor {
  
  private static final Logger LOG = Logger.getLogger(LogginOutInterceptor.class.getName());
  
  public LogginOutInterceptor() {
      super(Phase.PRE_STREAM);
  }
  
  @Override
  public void handleMessage(Message message) {
      OutputStream out = message.getContent(OutputStream.class);
      final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(out);
      message.setContent(OutputStream.class, newOut);
      newOut.registerCallback(new LoggingCallback());
  }
  
  public class LoggingCallback implements CachedOutputStreamCallback {
  
      @Override
      public void onFlush(CachedOutputStream cos) {
      }
  
      /**
       * Prints outgoing message on the screen. 
       */
      @Override
      public void onClose(CachedOutputStream cos) {
          try {
              StringBuilder builder = new StringBuilder();
              cos.writeCacheTo(builder, limit);
              String soapXml = builder.toString();
              GregorianCalendar calendar = new GregorianCalendar();
              Date date = new Date();
              calendar.setTime(date); //gets current date and time
              XMLGregorianCalendar timestamp = DatatypeFactory
                                                  .newInstance()
                                                  .newXMLGregorianCalendar(calendar);
              System.out.println("Sent at " + timestamp + ":\n" + XMLFormatter.format(soapXml));//NOPMD
              System.out.println("----------------------------" + "\n\n");//NOPMD
          } catch (Exception e) {
              LOG.log(Level.WARNING, e.getMessage(), Exception.class);
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I get <code>Skipping interceptor org.apache.cxf.interceptor.LoggingInInterceptor: Phase receive specified does not exist.</code> But I don't know why. </p>
  
  <p>And my second question is why I get so many logs on console? I get something like this:</p>
  
  <pre><code>08:37:33.829 [main] DEBUG org.apache.cxf.endpoint.ClientImpl - Interceptors contributed by databinding: []
  08:37:33.832 [main] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Adding interceptor org.apache.cxf.ws.policy.PolicyOutInterceptor@194164c to phase setup
  08:37:33.833 [main] WARN  o.a.cxf.phase.PhaseInterceptorChain - Skipping interceptor com.steria.sm.LoggingInInterceptor: Phase receive specified does not exist.
  08:37:33.833 [main] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Adding interceptor org.apache.cxf.interceptor.MessageSenderInterceptor@1fc9a67 to phase prepare-send
  08:37:33.834 [main] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Adding interceptor org.apache.cxf.jaxws.interceptors.SwAOutInterceptor@fcf5ba to phase pre-logical
  08:37:33.835 [main] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Adding interceptor org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor@16889eb to phase pre-logical
  08:37:33.836 [main] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Adding interceptor org.apache.cxf.jaxws.interceptors.HolderOutInterceptor@36c8f3 to phase pre-logical
  08:37:33.837 [main] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Adding interceptor org.apache.cxf.interceptor.AttachmentOutInterceptor@c3020c to phase pre-stream
  08:37:33.838 [main] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Adding interceptor org.apache.cxf.interceptor.StaxOutInterceptor@bb8a39 to phase pre-stream
  08:37:33.839 [main] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Adding interceptor org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor@6fd7d9 to phase pre-logical
  08:37:33.840 [main] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Adding interceptor org.apache.cxf.wsdl.interceptors.BareOutInterceptor@c412dd to phase marshal
  08:37:33.841 [main] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Adding interceptor org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor@b2aa22 to phase post-logical
  08:37:33.842 [main] DEBUG o.a.cxf.phase.PhaseInterceptorChain - Adding interceptor org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@1bfcec0 to phase write
  </code></pre>
  
  <p>I don't want to post all of those logs because it's a lot of them.</p>
  
  <p>Is anyone knows what did I wrong? Any help would be much appreciated.</p>