You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Wulff, Oliver" <Ol...@iona.com> on 2008/09/05 13:40:48 UTC

Custom InInterceptor not called

Hi there

I came across the problem that my custom interceptor is added to the interceptor chain (cxf log message) but handleMessage isn't called. It works fine if the interceptor is configured for the bean CXFBeanImpl but it doesn't work if the interceptor is configured in the spring config as a sub element of the jaxws:endpoint.

You can easily reproduce this with the demo "configuration_interceptor".

1) update the StreamInterceptor.java to only log that the interceptor has been called:
        //TODO

        boolean isOutbound = false;
        isOutbound = message == message.getExchange().getOutMessage()
               || message == message.getExchange().getOutFaultMessage();

        System.out.println(">>>handleMessage: " + isOutbound);

2) update the server.xml to configure the interceptor as an in and out interceptor in the CXFBusImpl Bean:
    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
        <property name="inInterceptors">
            <list>
                <ref bean="GZIPStream"/>
            </list>
        </property>
        <property name="outInterceptors">
            <list>
                <ref bean="GZIPStream"/>
            </list>
        </property>
    </bean>


3) output of the server looks as expected when the client is run:
server:
     [java] Starting Server
     [java] Server ready...
     [java] >>>handleMessage: false
     [java] Executing operation sayHi

     [java] >>>handleMessage: true


4) then, I've configured the "jaxws:endpoint" Bean in the server.xml:

    <jaxws:endpoint id="streamInterceptor"
        implementor="demo.stream.server.GreeterImpl"
        address="http://localhost:9000/SoapContext/SoapPort"
        wsdlLocation="wsdl/hello_world.wsdl"
        endpointName="e:SoapPort"
        serviceName="s:SOAPService"
        xmlns:e="http://apache.org/hello_world_soap_http"
        xmlns:s="http://apache.org/hello_world_soap_http">
        <jaxws:features>
            <bean class="org.apache.cxf.feature.LoggingFeature"/>
        </jaxws:features>
       
        <jaxws:inInterceptors>
            <ref bean="GZIPStream"/>
        </jaxws:inInterceptors>
                 
       <jaxws:outInterceptors>
           <ref bean="GZIPStream"/>
       </jaxws:outInterceptors>

    </jaxws:endpoint>


5) output of the server when the client is run:
server:
     [java] Starting Server
     [java] Server ready...
     [java] Executing operation sayHi

     [java] >>>handleMessage: true

handleMessage is NOT called before the request is dispatched to the implementation.

Any ideas?

Thanks
Oliver

Re: AW: AW: Custom InInterceptor not called

Posted by Daniel Kulp <dk...@apache.org>.
On Monday 15 September 2008 10:17:49 am Wulff, Oliver wrote:
> Hi Dan
>
> OK, the recommendation is that when you configure a jaxws:endpoint in the
> spring configuration file you must not call Endpoint.publish(...) but
> instead instantiate the bus like this in the mainline:
> org.apache.cxf.BusFactory.getDefaultBus();

Well, the recommendation is to just use whatever method works best for your 
application for publishing your endpoint, but don't use two methods to 
publish the same endpoint.   :-)

But yes, if you have endpoints defined in spring, you shouldn't call 
Endpoint.publish.


Dan



>
> Thanks
> Oliver
>
>
> -----Ursprüngliche Nachricht-----
> Von: Daniel Kulp [mailto:dkulp@apache.org]
> Gesendet: Fr 12.09.2008 20:47
> An: users@cxf.apache.org
> Cc: Wulff, Oliver
> Betreff: Re: AW: Custom InInterceptor not called
>
>
> It's the multi-plexing stuff.   There are definitely issues with the
> multi-plexing.   Any custom interceptors added to the incoming chains that
> execute before the EndpointSelectionInterceptor will not get called at all.
> Not really sure what to do about that though.
>
> The multi-plexing stuff is to allow soap 1.1 and 1.2 endpoints to run on
> the same URL.   One thing I'm thinking is if you Endpoint.publish onto the
> same endpoint, but both are 1.1 or both are 1.2, throw the exception as the
> multiplexing is useless then.
>
> Dan
>
> On Friday 12 September 2008 1:56:47 pm Daniel Kulp wrote:
> > OK.  Figured out the problem.   Following your instructions exactly
> > doesn't work on 2.2 either.   However, it's a problem with your setup.
> >
> > Your server.xml creates an endpoint on
> > http://localhost:9000/SoapContext/SoapPort
> > at bus init time, which is fine.
> >
> > However, the Server.java then calls an Endpoint.publish(...) with the
> > same URL and with the same names/wsdl/etc....    SOMEHOW (not sure yet),
> > that is only PARTIALLY changing the the service registered on that URL.  
> > I have to check what the right behavior is here.   I THINK the
> > Endpoint.publish(...) should throw an exception in this case, but I'm not
> > completely sure.   It might be trying to setup a multiplex case which may
> > make some sense as well.   In that case, the stream level stuff would
> > come before we can de-multiplex it so it may be a "last wins" case.   
> > Definitely need to dig more on that.
> >
> > In anycase, if you update your Server.java to do:
> >     protected Server() throws Exception {
> >         System.out.println("Starting Server");
> >         //just startup a Bus, the jaxws:endpoint defined in server.xml
> >         //will then start
> >         org.apache.cxf.BusFactory.getDefaultBus();
> >     }
> >
> > Then it would work fine.
> >
> > Dan
> >
> > On Friday 12 September 2008 1:28:41 pm Daniel Kulp wrote:
> > > On Friday 12 September 2008 7:55:33 am Wulff, Oliver wrote:
> > > > Were you able to reproduce the issue?
> > >
> > > Well, it works with 2.2 snapshots, but not with 2.1.3 snapshots.   That
> > > really sucks.   I have NO idea what fixes to 2.2 would have impacted
> > > this. I'll dig in.
> > >
> > > Dan
> > >
> > > > Thanks
> > > > Oliver
> > > >
> > > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
> > > > Gesendet: So 07.09.2008 00:01
> > > > An: users@cxf.apache.org; Daniel Kulp; users@cxf.apache.org
> > > > Betreff: AW: Custom InInterceptor not called
> > > >
> > > > Hi Dan
> > > >
> > > > I give it a try with 2.1.2 but without success.
> > > >
> > > > I've done the following:
> > > >
> > > > 1) updated build.xml:
> > > >   <target name="server" description="run demo server"
> > > > depends="build"> <cxfrun classname="demo.stream.server.Server"
> > > > 	    param1="${basedir}/wsdl/hello_world.wsdl"
> > > > 	    jvmarg1="-Dcxf.config.file=server.xml"/>
> > > >   </target>
> > > >
> > > > 2) copied server.xml to directory configuration_interceptor
> > > >
> > > > 3) updated StreamInterceptor.java:
> > > >     public void handleMessage(Message message) {
> > > >         //TODO
> > > >
> > > >         boolean isOutbound = false;
> > > >         isOutbound = message == message.getExchange().getOutMessage()
> > > >
> > > >                || message ==
> > > >                || message.getExchange().getOutFaultMessage();
> > > >
> > > > System.out.println("handleMessage. Outbound: " + isOutbound);
> > > >         /*if (isOutbound) {
> > > >             OutputStream os = message.getContent(OutputStream.class);
> > > >             CachedStream cs = new CachedStream();
> > > >             message.setContent(OutputStream.class, cs);
> > > >
> > > >             message.getInterceptorChain().doIntercept(message);
> > > >
> > > >             try {
> > > >                 cs.flush();
> > > >                 CachedOutputStream csnew = (CachedOutputStream)
> > > > message .getContent(OutputStream.class);
> > > >                 GZIPOutputStream zipOutput = new
> > > > GZIPOutputStream(os);
> > > > CachedOutputStream.copyStream(csnew.getInputStream(), zipOutput,
> > > > 1024);
> > > >
> > > >                 cs.close();
> > > >                 zipOutput.close();
> > > >                 os.flush();
> > > >
> > > >                 message.setContent(OutputStream.class, os);
> > > >             } catch (IOException ioe) {
> > > >                 ioe.printStackTrace();
> > > >             }
> > > >         } else {
> > > >             try {
> > > >                 InputStream is =
> > > > message.getContent(InputStream.class); GZIPInputStream zipInput = new
> > > > GZIPInputStream(is); message.setContent(InputStream.class, zipInput);
> > > > } catch (IOException ioe) {
> > > >                 ioe.printStackTrace();
> > > >             }
> > > >         }*/
> > > >     }
> > > >
> > > > 4. updated server.xml:
> > > > ...
> > > >     <cxf:bus>
> > > >         <!--cxf:inInterceptors>
> > > >             <ref bean="GZIPStream"/>
> > > >         </cxf:inInterceptors>
> > > >         <cxf:inFaultInterceptors>
> > > >             <ref bean="GZIPStream"/>
> > > >         </cxf:inFaultInterceptors>
> > > >         <cxf:outInterceptors>
> > > >             <ref bean="GZIPStream"/>
> > > >         </cxf:outInterceptors-->
> > > >         <!--cxf:outFaultInterceptors>
> > > >              <ref bean="GZIPStream"/>
> > > >         </cxf:outFaultInterceptors-->
> > > >     </cxf:bus>
> > > > ...
> > > > <jaxws:endpoint id="streamInterceptor"
> > > > implementor="demo.stream.server.GreeterImpl"
> > > > address="http://localhost:9000/SoapContext/SoapPort"
> > > > wsdlLocation="wsdl/hello_world.wsdl"
> > > > endpointName="e:SoapPort"
> > > > serviceName="s:SOAPService"
> > > > xmlns:e="http://apache.org/hello_world_soap_http"
> > > > xmlns:s="http://apache.org/hello_world_soap_http">
> > > > <jaxws:features>
> > > > <bean class="org.apache.cxf.feature.LoggingFeature"/>
> > > > </jaxws:features>
> > > >
> > > > <jaxws:inInterceptors>
> > > > <ref bean="GZIPStream"/>
> > > > </jaxws:inInterceptors>
> > > >
> > > > <jaxws:outInterceptors>
> > > > <ref bean="GZIPStream"/>
> > > > </jaxws:outInterceptors>
> > > >
> > > > </jaxws:endpoint>
> > > >
> > > >
> > > > And again, the interceptor is not called when the request is
> > > > processed at the server side. It is called only when the response is
> > > > processed on the server side.
> > > >
> > > > Thanks
> > > > Oliver
> > > >
> > > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
> > > > Gesendet: Fr 05.09.2008 16:16
> > > > An: Daniel Kulp; users@cxf.apache.org
> > > > Betreff: AW: Custom InInterceptor not called
> > > >
> > > > Hi Dan
> > > >
> > > > I use version 2.0.6.
> > > >
> > > > Thanks
> > > > Oliver
> > > >
> > > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Daniel Kulp [mailto:dkulp@apache.org]
> > > > Gesendet: Fr 05.09.2008 16:10
> > > > An: users@cxf.apache.org
> > > > Cc: Wulff, Oliver
> > > > Betreff: Re: Custom InInterceptor not called
> > > >
> > > >
> > > > Oliver,
> > > >
> > > > I tried this with the latest 2.2 snapshot code yesterday and it
> > > > worked fine. I got both messages printed out (true and false) on the
> > > > console.
> > > >
> > > > Can you double check with the 2.1.2 release or let me know what
> > > > version this affects?
> > > >
> > > > Dan
> > > >
> > > > On Friday 05 September 2008 7:40:48 am Wulff, Oliver wrote:
> > > > > Hi there
> > > > >
> > > > > I came across the problem that my custom interceptor is added to
> > > > > the interceptor chain (cxf log message) but handleMessage isn't
> > > > > called. It works fine if the interceptor is configured for the bean
> > > > > CXFBeanImpl but it doesn't work if the interceptor is configured in
> > > > > the spring config as a sub element of the jaxws:endpoint.
> > > > >
> > > > > You can easily reproduce this with the demo
> > > > > "configuration_interceptor".
> > > > >
> > > > > 1) update the StreamInterceptor.java to only log that the
> > > > > interceptor has been called: //TODO
> > > > >
> > > > >         boolean isOutbound = false;
> > > > >         isOutbound = message ==
> > > > > message.getExchange().getOutMessage()
> > > > >
> > > > >                || message ==
> > > > >                || message.getExchange().getOutFaultMessage();
> > > > >
> > > > >         System.out.println(">>>handleMessage: " + isOutbound);
> > > > >
> > > > > 2) update the server.xml to configure the interceptor as an in and
> > > > > out interceptor in the CXFBusImpl Bean: <bean id="cxf"
> > > > > class="org.apache.cxf.bus.CXFBusImpl">
> > > > >         <property name="inInterceptors">
> > > > >             <list>
> > > > >                 <ref bean="GZIPStream"/>
> > > > >             </list>
> > > > >         </property>
> > > > >         <property name="outInterceptors">
> > > > >             <list>
> > > > >                 <ref bean="GZIPStream"/>
> > > > >             </list>
> > > > >         </property>
> > > > >     </bean>
> > > > >
> > > > >
> > > > > 3) output of the server looks as expected when the client is run:
> > > > > server:
> > > > >      [java] Starting Server
> > > > >      [java] Server ready...
> > > > >      [java] >>>handleMessage: false
> > > > >      [java] Executing operation sayHi
> > > > >
> > > > >      [java] >>>handleMessage: true
> > > > >
> > > > >
> > > > > 4) then, I've configured the "jaxws:endpoint" Bean in the
> > > > > server.xml:
> > > > >
> > > > >     <jaxws:endpoint id="streamInterceptor"
> > > > >         implementor="demo.stream.server.GreeterImpl"
> > > > >         address="http://localhost:9000/SoapContext/SoapPort"
> > > > >         wsdlLocation="wsdl/hello_world.wsdl"
> > > > >         endpointName="e:SoapPort"
> > > > >         serviceName="s:SOAPService"
> > > > >         xmlns:e="http://apache.org/hello_world_soap_http"
> > > > >         xmlns:s="http://apache.org/hello_world_soap_http">
> > > > >         <jaxws:features>
> > > > >             <bean class="org.apache.cxf.feature.LoggingFeature"/>
> > > > >         </jaxws:features>
> > > > >
> > > > >         <jaxws:inInterceptors>
> > > > >             <ref bean="GZIPStream"/>
> > > > >         </jaxws:inInterceptors>
> > > > >
> > > > >        <jaxws:outInterceptors>
> > > > >            <ref bean="GZIPStream"/>
> > > > >        </jaxws:outInterceptors>
> > > > >
> > > > >     </jaxws:endpoint>
> > > > >
> > > > >
> > > > > 5) output of the server when the client is run:
> > > > > server:
> > > > >      [java] Starting Server
> > > > >      [java] Server ready...
> > > > >      [java] Executing operation sayHi
> > > > >
> > > > >      [java] >>>handleMessage: true
> > > > >
> > > > > handleMessage is NOT called before the request is dispatched to the
> > > > > implementation.
> > > > >
> > > > > Any ideas?
> > > > >
> > > > > Thanks
> > > > > Oliver



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

AW: AW: Custom InInterceptor not called

Posted by "Wulff, Oliver" <Ol...@iona.com>.
Hi Dan

OK, the recommendation is that when you configure a jaxws:endpoint in the spring configuration file you must not call Endpoint.publish(...) but instead instantiate the bus like this in the mainline:
org.apache.cxf.BusFactory.getDefaultBus();

Thanks
Oliver


-----Ursprüngliche Nachricht-----
Von: Daniel Kulp [mailto:dkulp@apache.org]
Gesendet: Fr 12.09.2008 20:47
An: users@cxf.apache.org
Cc: Wulff, Oliver
Betreff: Re: AW: Custom InInterceptor not called
 

It's the multi-plexing stuff.   There are definitely issues with the 
multi-plexing.   Any custom interceptors added to the incoming chains that 
execute before the EndpointSelectionInterceptor will not get called at all.    
Not really sure what to do about that though.

The multi-plexing stuff is to allow soap 1.1 and 1.2 endpoints to run on the 
same URL.   One thing I'm thinking is if you Endpoint.publish onto the same 
endpoint, but both are 1.1 or both are 1.2, throw the exception as the 
multiplexing is useless then.  

Dan


On Friday 12 September 2008 1:56:47 pm Daniel Kulp wrote:
> OK.  Figured out the problem.   Following your instructions exactly doesn't
> work on 2.2 either.   However, it's a problem with your setup.
>
> Your server.xml creates an endpoint on
> http://localhost:9000/SoapContext/SoapPort
> at bus init time, which is fine.
>
> However, the Server.java then calls an Endpoint.publish(...) with the same
> URL and with the same names/wsdl/etc....    SOMEHOW (not sure yet), that is
> only PARTIALLY changing the the service registered on that URL.   I have to
> check what the right behavior is here.   I THINK the Endpoint.publish(...)
> should throw an exception in this case, but I'm not completely sure.   It
> might be trying to setup a multiplex case which may make some sense as
> well.   In that case, the stream level stuff would come before we can
> de-multiplex it so it may be a "last wins" case.    Definitely need to dig
> more on that.
>
> In anycase, if you update your Server.java to do:
>     protected Server() throws Exception {
>         System.out.println("Starting Server");
>         //just startup a Bus, the jaxws:endpoint defined in server.xml
>         //will then start
>         org.apache.cxf.BusFactory.getDefaultBus();
>     }
>
> Then it would work fine.
>
> Dan
>
> On Friday 12 September 2008 1:28:41 pm Daniel Kulp wrote:
> > On Friday 12 September 2008 7:55:33 am Wulff, Oliver wrote:
> > > Were you able to reproduce the issue?
> >
> > Well, it works with 2.2 snapshots, but not with 2.1.3 snapshots.   That
> > really sucks.   I have NO idea what fixes to 2.2 would have impacted
> > this. I'll dig in.
> >
> > Dan
> >
> > > Thanks
> > > Oliver
> > >
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
> > > Gesendet: So 07.09.2008 00:01
> > > An: users@cxf.apache.org; Daniel Kulp; users@cxf.apache.org
> > > Betreff: AW: Custom InInterceptor not called
> > >
> > > Hi Dan
> > >
> > > I give it a try with 2.1.2 but without success.
> > >
> > > I've done the following:
> > >
> > > 1) updated build.xml:
> > >   <target name="server" description="run demo server" depends="build">
> > >     <cxfrun classname="demo.stream.server.Server"
> > > 	    param1="${basedir}/wsdl/hello_world.wsdl"
> > > 	    jvmarg1="-Dcxf.config.file=server.xml"/>
> > >   </target>
> > >
> > > 2) copied server.xml to directory configuration_interceptor
> > >
> > > 3) updated StreamInterceptor.java:
> > >     public void handleMessage(Message message) {
> > >         //TODO
> > >
> > >         boolean isOutbound = false;
> > >         isOutbound = message == message.getExchange().getOutMessage()
> > >
> > >                || message ==
> > >                || message.getExchange().getOutFaultMessage();
> > >
> > > System.out.println("handleMessage. Outbound: " + isOutbound);
> > >         /*if (isOutbound) {
> > >             OutputStream os = message.getContent(OutputStream.class);
> > >             CachedStream cs = new CachedStream();
> > >             message.setContent(OutputStream.class, cs);
> > >
> > >             message.getInterceptorChain().doIntercept(message);
> > >
> > >             try {
> > >                 cs.flush();
> > >                 CachedOutputStream csnew = (CachedOutputStream) message
> > >                     .getContent(OutputStream.class);
> > >                 GZIPOutputStream zipOutput = new GZIPOutputStream(os);
> > >                 CachedOutputStream.copyStream(csnew.getInputStream(),
> > > zipOutput, 1024);
> > >
> > >                 cs.close();
> > >                 zipOutput.close();
> > >                 os.flush();
> > >
> > >                 message.setContent(OutputStream.class, os);
> > >             } catch (IOException ioe) {
> > >                 ioe.printStackTrace();
> > >             }
> > >         } else {
> > >             try {
> > >                 InputStream is = message.getContent(InputStream.class);
> > >                 GZIPInputStream zipInput = new GZIPInputStream(is);
> > >                 message.setContent(InputStream.class, zipInput);
> > >             } catch (IOException ioe) {
> > >                 ioe.printStackTrace();
> > >             }
> > >         }*/
> > >     }
> > >
> > > 4. updated server.xml:
> > > ...
> > >     <cxf:bus>
> > >         <!--cxf:inInterceptors>
> > >             <ref bean="GZIPStream"/>
> > >         </cxf:inInterceptors>
> > >         <cxf:inFaultInterceptors>
> > >             <ref bean="GZIPStream"/>
> > >         </cxf:inFaultInterceptors>
> > >         <cxf:outInterceptors>
> > >             <ref bean="GZIPStream"/>
> > >         </cxf:outInterceptors-->
> > >         <!--cxf:outFaultInterceptors>
> > >              <ref bean="GZIPStream"/>
> > >         </cxf:outFaultInterceptors-->
> > >     </cxf:bus>
> > > ...
> > > <jaxws:endpoint id="streamInterceptor"
> > > implementor="demo.stream.server.GreeterImpl"
> > > address="http://localhost:9000/SoapContext/SoapPort"
> > > wsdlLocation="wsdl/hello_world.wsdl"
> > > endpointName="e:SoapPort"
> > > serviceName="s:SOAPService"
> > > xmlns:e="http://apache.org/hello_world_soap_http"
> > > xmlns:s="http://apache.org/hello_world_soap_http">
> > > <jaxws:features>
> > > <bean class="org.apache.cxf.feature.LoggingFeature"/>
> > > </jaxws:features>
> > >
> > > <jaxws:inInterceptors>
> > > <ref bean="GZIPStream"/>
> > > </jaxws:inInterceptors>
> > >
> > > <jaxws:outInterceptors>
> > > <ref bean="GZIPStream"/>
> > > </jaxws:outInterceptors>
> > >
> > > </jaxws:endpoint>
> > >
> > >
> > > And again, the interceptor is not called when the request is processed
> > > at the server side. It is called only when the response is processed on
> > > the server side.
> > >
> > > Thanks
> > > Oliver
> > >
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
> > > Gesendet: Fr 05.09.2008 16:16
> > > An: Daniel Kulp; users@cxf.apache.org
> > > Betreff: AW: Custom InInterceptor not called
> > >
> > > Hi Dan
> > >
> > > I use version 2.0.6.
> > >
> > > Thanks
> > > Oliver
> > >
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Daniel Kulp [mailto:dkulp@apache.org]
> > > Gesendet: Fr 05.09.2008 16:10
> > > An: users@cxf.apache.org
> > > Cc: Wulff, Oliver
> > > Betreff: Re: Custom InInterceptor not called
> > >
> > >
> > > Oliver,
> > >
> > > I tried this with the latest 2.2 snapshot code yesterday and it worked
> > > fine. I got both messages printed out (true and false) on the console.
> > >
> > > Can you double check with the 2.1.2 release or let me know what version
> > > this affects?
> > >
> > > Dan
> > >
> > > On Friday 05 September 2008 7:40:48 am Wulff, Oliver wrote:
> > > > Hi there
> > > >
> > > > I came across the problem that my custom interceptor is added to the
> > > > interceptor chain (cxf log message) but handleMessage isn't called.
> > > > It works fine if the interceptor is configured for the bean
> > > > CXFBeanImpl but it doesn't work if the interceptor is configured in
> > > > the spring config as a sub element of the jaxws:endpoint.
> > > >
> > > > You can easily reproduce this with the demo
> > > > "configuration_interceptor".
> > > >
> > > > 1) update the StreamInterceptor.java to only log that the interceptor
> > > > has been called: //TODO
> > > >
> > > >         boolean isOutbound = false;
> > > >         isOutbound = message == message.getExchange().getOutMessage()
> > > >
> > > >                || message ==
> > > >                || message.getExchange().getOutFaultMessage();
> > > >
> > > >         System.out.println(">>>handleMessage: " + isOutbound);
> > > >
> > > > 2) update the server.xml to configure the interceptor as an in and
> > > > out interceptor in the CXFBusImpl Bean: <bean id="cxf"
> > > > class="org.apache.cxf.bus.CXFBusImpl">
> > > >         <property name="inInterceptors">
> > > >             <list>
> > > >                 <ref bean="GZIPStream"/>
> > > >             </list>
> > > >         </property>
> > > >         <property name="outInterceptors">
> > > >             <list>
> > > >                 <ref bean="GZIPStream"/>
> > > >             </list>
> > > >         </property>
> > > >     </bean>
> > > >
> > > >
> > > > 3) output of the server looks as expected when the client is run:
> > > > server:
> > > >      [java] Starting Server
> > > >      [java] Server ready...
> > > >      [java] >>>handleMessage: false
> > > >      [java] Executing operation sayHi
> > > >
> > > >      [java] >>>handleMessage: true
> > > >
> > > >
> > > > 4) then, I've configured the "jaxws:endpoint" Bean in the server.xml:
> > > >
> > > >     <jaxws:endpoint id="streamInterceptor"
> > > >         implementor="demo.stream.server.GreeterImpl"
> > > >         address="http://localhost:9000/SoapContext/SoapPort"
> > > >         wsdlLocation="wsdl/hello_world.wsdl"
> > > >         endpointName="e:SoapPort"
> > > >         serviceName="s:SOAPService"
> > > >         xmlns:e="http://apache.org/hello_world_soap_http"
> > > >         xmlns:s="http://apache.org/hello_world_soap_http">
> > > >         <jaxws:features>
> > > >             <bean class="org.apache.cxf.feature.LoggingFeature"/>
> > > >         </jaxws:features>
> > > >
> > > >         <jaxws:inInterceptors>
> > > >             <ref bean="GZIPStream"/>
> > > >         </jaxws:inInterceptors>
> > > >
> > > >        <jaxws:outInterceptors>
> > > >            <ref bean="GZIPStream"/>
> > > >        </jaxws:outInterceptors>
> > > >
> > > >     </jaxws:endpoint>
> > > >
> > > >
> > > > 5) output of the server when the client is run:
> > > > server:
> > > >      [java] Starting Server
> > > >      [java] Server ready...
> > > >      [java] Executing operation sayHi
> > > >
> > > >      [java] >>>handleMessage: true
> > > >
> > > > handleMessage is NOT called before the request is dispatched to the
> > > > implementation.
> > > >
> > > > Any ideas?
> > > >
> > > > Thanks
> > > > Oliver



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog


Re: AW: Custom InInterceptor not called

Posted by Daniel Kulp <dk...@apache.org>.
It's the multi-plexing stuff.   There are definitely issues with the 
multi-plexing.   Any custom interceptors added to the incoming chains that 
execute before the EndpointSelectionInterceptor will not get called at all.    
Not really sure what to do about that though.

The multi-plexing stuff is to allow soap 1.1 and 1.2 endpoints to run on the 
same URL.   One thing I'm thinking is if you Endpoint.publish onto the same 
endpoint, but both are 1.1 or both are 1.2, throw the exception as the 
multiplexing is useless then.  

Dan


On Friday 12 September 2008 1:56:47 pm Daniel Kulp wrote:
> OK.  Figured out the problem.   Following your instructions exactly doesn't
> work on 2.2 either.   However, it's a problem with your setup.
>
> Your server.xml creates an endpoint on
> http://localhost:9000/SoapContext/SoapPort
> at bus init time, which is fine.
>
> However, the Server.java then calls an Endpoint.publish(...) with the same
> URL and with the same names/wsdl/etc....    SOMEHOW (not sure yet), that is
> only PARTIALLY changing the the service registered on that URL.   I have to
> check what the right behavior is here.   I THINK the Endpoint.publish(...)
> should throw an exception in this case, but I'm not completely sure.   It
> might be trying to setup a multiplex case which may make some sense as
> well.   In that case, the stream level stuff would come before we can
> de-multiplex it so it may be a "last wins" case.    Definitely need to dig
> more on that.
>
> In anycase, if you update your Server.java to do:
>     protected Server() throws Exception {
>         System.out.println("Starting Server");
>         //just startup a Bus, the jaxws:endpoint defined in server.xml
>         //will then start
>         org.apache.cxf.BusFactory.getDefaultBus();
>     }
>
> Then it would work fine.
>
> Dan
>
> On Friday 12 September 2008 1:28:41 pm Daniel Kulp wrote:
> > On Friday 12 September 2008 7:55:33 am Wulff, Oliver wrote:
> > > Were you able to reproduce the issue?
> >
> > Well, it works with 2.2 snapshots, but not with 2.1.3 snapshots.   That
> > really sucks.   I have NO idea what fixes to 2.2 would have impacted
> > this. I'll dig in.
> >
> > Dan
> >
> > > Thanks
> > > Oliver
> > >
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
> > > Gesendet: So 07.09.2008 00:01
> > > An: users@cxf.apache.org; Daniel Kulp; users@cxf.apache.org
> > > Betreff: AW: Custom InInterceptor not called
> > >
> > > Hi Dan
> > >
> > > I give it a try with 2.1.2 but without success.
> > >
> > > I've done the following:
> > >
> > > 1) updated build.xml:
> > >   <target name="server" description="run demo server" depends="build">
> > >     <cxfrun classname="demo.stream.server.Server"
> > > 	    param1="${basedir}/wsdl/hello_world.wsdl"
> > > 	    jvmarg1="-Dcxf.config.file=server.xml"/>
> > >   </target>
> > >
> > > 2) copied server.xml to directory configuration_interceptor
> > >
> > > 3) updated StreamInterceptor.java:
> > >     public void handleMessage(Message message) {
> > >         //TODO
> > >
> > >         boolean isOutbound = false;
> > >         isOutbound = message == message.getExchange().getOutMessage()
> > >
> > >                || message ==
> > >                || message.getExchange().getOutFaultMessage();
> > >
> > > System.out.println("handleMessage. Outbound: " + isOutbound);
> > >         /*if (isOutbound) {
> > >             OutputStream os = message.getContent(OutputStream.class);
> > >             CachedStream cs = new CachedStream();
> > >             message.setContent(OutputStream.class, cs);
> > >
> > >             message.getInterceptorChain().doIntercept(message);
> > >
> > >             try {
> > >                 cs.flush();
> > >                 CachedOutputStream csnew = (CachedOutputStream) message
> > >                     .getContent(OutputStream.class);
> > >                 GZIPOutputStream zipOutput = new GZIPOutputStream(os);
> > >                 CachedOutputStream.copyStream(csnew.getInputStream(),
> > > zipOutput, 1024);
> > >
> > >                 cs.close();
> > >                 zipOutput.close();
> > >                 os.flush();
> > >
> > >                 message.setContent(OutputStream.class, os);
> > >             } catch (IOException ioe) {
> > >                 ioe.printStackTrace();
> > >             }
> > >         } else {
> > >             try {
> > >                 InputStream is = message.getContent(InputStream.class);
> > >                 GZIPInputStream zipInput = new GZIPInputStream(is);
> > >                 message.setContent(InputStream.class, zipInput);
> > >             } catch (IOException ioe) {
> > >                 ioe.printStackTrace();
> > >             }
> > >         }*/
> > >     }
> > >
> > > 4. updated server.xml:
> > > ...
> > >     <cxf:bus>
> > >         <!--cxf:inInterceptors>
> > >             <ref bean="GZIPStream"/>
> > >         </cxf:inInterceptors>
> > >         <cxf:inFaultInterceptors>
> > >             <ref bean="GZIPStream"/>
> > >         </cxf:inFaultInterceptors>
> > >         <cxf:outInterceptors>
> > >             <ref bean="GZIPStream"/>
> > >         </cxf:outInterceptors-->
> > >         <!--cxf:outFaultInterceptors>
> > >              <ref bean="GZIPStream"/>
> > >         </cxf:outFaultInterceptors-->
> > >     </cxf:bus>
> > > ...
> > > <jaxws:endpoint id="streamInterceptor"
> > > implementor="demo.stream.server.GreeterImpl"
> > > address="http://localhost:9000/SoapContext/SoapPort"
> > > wsdlLocation="wsdl/hello_world.wsdl"
> > > endpointName="e:SoapPort"
> > > serviceName="s:SOAPService"
> > > xmlns:e="http://apache.org/hello_world_soap_http"
> > > xmlns:s="http://apache.org/hello_world_soap_http">
> > > <jaxws:features>
> > > <bean class="org.apache.cxf.feature.LoggingFeature"/>
> > > </jaxws:features>
> > >
> > > <jaxws:inInterceptors>
> > > <ref bean="GZIPStream"/>
> > > </jaxws:inInterceptors>
> > >
> > > <jaxws:outInterceptors>
> > > <ref bean="GZIPStream"/>
> > > </jaxws:outInterceptors>
> > >
> > > </jaxws:endpoint>
> > >
> > >
> > > And again, the interceptor is not called when the request is processed
> > > at the server side. It is called only when the response is processed on
> > > the server side.
> > >
> > > Thanks
> > > Oliver
> > >
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
> > > Gesendet: Fr 05.09.2008 16:16
> > > An: Daniel Kulp; users@cxf.apache.org
> > > Betreff: AW: Custom InInterceptor not called
> > >
> > > Hi Dan
> > >
> > > I use version 2.0.6.
> > >
> > > Thanks
> > > Oliver
> > >
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Daniel Kulp [mailto:dkulp@apache.org]
> > > Gesendet: Fr 05.09.2008 16:10
> > > An: users@cxf.apache.org
> > > Cc: Wulff, Oliver
> > > Betreff: Re: Custom InInterceptor not called
> > >
> > >
> > > Oliver,
> > >
> > > I tried this with the latest 2.2 snapshot code yesterday and it worked
> > > fine. I got both messages printed out (true and false) on the console.
> > >
> > > Can you double check with the 2.1.2 release or let me know what version
> > > this affects?
> > >
> > > Dan
> > >
> > > On Friday 05 September 2008 7:40:48 am Wulff, Oliver wrote:
> > > > Hi there
> > > >
> > > > I came across the problem that my custom interceptor is added to the
> > > > interceptor chain (cxf log message) but handleMessage isn't called.
> > > > It works fine if the interceptor is configured for the bean
> > > > CXFBeanImpl but it doesn't work if the interceptor is configured in
> > > > the spring config as a sub element of the jaxws:endpoint.
> > > >
> > > > You can easily reproduce this with the demo
> > > > "configuration_interceptor".
> > > >
> > > > 1) update the StreamInterceptor.java to only log that the interceptor
> > > > has been called: //TODO
> > > >
> > > >         boolean isOutbound = false;
> > > >         isOutbound = message == message.getExchange().getOutMessage()
> > > >
> > > >                || message ==
> > > >                || message.getExchange().getOutFaultMessage();
> > > >
> > > >         System.out.println(">>>handleMessage: " + isOutbound);
> > > >
> > > > 2) update the server.xml to configure the interceptor as an in and
> > > > out interceptor in the CXFBusImpl Bean: <bean id="cxf"
> > > > class="org.apache.cxf.bus.CXFBusImpl">
> > > >         <property name="inInterceptors">
> > > >             <list>
> > > >                 <ref bean="GZIPStream"/>
> > > >             </list>
> > > >         </property>
> > > >         <property name="outInterceptors">
> > > >             <list>
> > > >                 <ref bean="GZIPStream"/>
> > > >             </list>
> > > >         </property>
> > > >     </bean>
> > > >
> > > >
> > > > 3) output of the server looks as expected when the client is run:
> > > > server:
> > > >      [java] Starting Server
> > > >      [java] Server ready...
> > > >      [java] >>>handleMessage: false
> > > >      [java] Executing operation sayHi
> > > >
> > > >      [java] >>>handleMessage: true
> > > >
> > > >
> > > > 4) then, I've configured the "jaxws:endpoint" Bean in the server.xml:
> > > >
> > > >     <jaxws:endpoint id="streamInterceptor"
> > > >         implementor="demo.stream.server.GreeterImpl"
> > > >         address="http://localhost:9000/SoapContext/SoapPort"
> > > >         wsdlLocation="wsdl/hello_world.wsdl"
> > > >         endpointName="e:SoapPort"
> > > >         serviceName="s:SOAPService"
> > > >         xmlns:e="http://apache.org/hello_world_soap_http"
> > > >         xmlns:s="http://apache.org/hello_world_soap_http">
> > > >         <jaxws:features>
> > > >             <bean class="org.apache.cxf.feature.LoggingFeature"/>
> > > >         </jaxws:features>
> > > >
> > > >         <jaxws:inInterceptors>
> > > >             <ref bean="GZIPStream"/>
> > > >         </jaxws:inInterceptors>
> > > >
> > > >        <jaxws:outInterceptors>
> > > >            <ref bean="GZIPStream"/>
> > > >        </jaxws:outInterceptors>
> > > >
> > > >     </jaxws:endpoint>
> > > >
> > > >
> > > > 5) output of the server when the client is run:
> > > > server:
> > > >      [java] Starting Server
> > > >      [java] Server ready...
> > > >      [java] Executing operation sayHi
> > > >
> > > >      [java] >>>handleMessage: true
> > > >
> > > > handleMessage is NOT called before the request is dispatched to the
> > > > implementation.
> > > >
> > > > Any ideas?
> > > >
> > > > Thanks
> > > > Oliver



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: AW: Custom InInterceptor not called

Posted by Daniel Kulp <dk...@apache.org>.
OK.  Figured out the problem.   Following your instructions exactly doesn't 
work on 2.2 either.   However, it's a problem with your setup.  

Your server.xml creates an endpoint on 
http://localhost:9000/SoapContext/SoapPort
at bus init time, which is fine.   

However, the Server.java then calls an Endpoint.publish(...) with the same URL 
and with the same names/wsdl/etc....    SOMEHOW (not sure yet), that is only 
PARTIALLY changing the the service registered on that URL.   I have to check 
what the right behavior is here.   I THINK the Endpoint.publish(...) should 
throw an exception in this case, but I'm not completely sure.   It might be 
trying to setup a multiplex case which may make some sense as well.   In that 
case, the stream level stuff would come before we can de-multiplex it so it 
may be a "last wins" case.    Definitely need to dig more on that.

In anycase, if you update your Server.java to do:    
    protected Server() throws Exception {
        System.out.println("Starting Server");
        //just startup a Bus, the jaxws:endpoint defined in server.xml
        //will then start
        org.apache.cxf.BusFactory.getDefaultBus();
    }

Then it would work fine.

Dan



On Friday 12 September 2008 1:28:41 pm Daniel Kulp wrote:
> On Friday 12 September 2008 7:55:33 am Wulff, Oliver wrote:
> > Were you able to reproduce the issue?
>
> Well, it works with 2.2 snapshots, but not with 2.1.3 snapshots.   That
> really sucks.   I have NO idea what fixes to 2.2 would have impacted this. 
>  I'll dig in.
>
> Dan
>
> > Thanks
> > Oliver
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
> > Gesendet: So 07.09.2008 00:01
> > An: users@cxf.apache.org; Daniel Kulp; users@cxf.apache.org
> > Betreff: AW: Custom InInterceptor not called
> >
> > Hi Dan
> >
> > I give it a try with 2.1.2 but without success.
> >
> > I've done the following:
> >
> > 1) updated build.xml:
> >   <target name="server" description="run demo server" depends="build">
> >     <cxfrun classname="demo.stream.server.Server"
> > 	    param1="${basedir}/wsdl/hello_world.wsdl"
> > 	    jvmarg1="-Dcxf.config.file=server.xml"/>
> >   </target>
> >
> > 2) copied server.xml to directory configuration_interceptor
> >
> > 3) updated StreamInterceptor.java:
> >     public void handleMessage(Message message) {
> >         //TODO
> >
> >         boolean isOutbound = false;
> >         isOutbound = message == message.getExchange().getOutMessage()
> >
> >                || message == message.getExchange().getOutFaultMessage();
> >
> > System.out.println("handleMessage. Outbound: " + isOutbound);
> >         /*if (isOutbound) {
> >             OutputStream os = message.getContent(OutputStream.class);
> >             CachedStream cs = new CachedStream();
> >             message.setContent(OutputStream.class, cs);
> >
> >             message.getInterceptorChain().doIntercept(message);
> >
> >             try {
> >                 cs.flush();
> >                 CachedOutputStream csnew = (CachedOutputStream) message
> >                     .getContent(OutputStream.class);
> >                 GZIPOutputStream zipOutput = new GZIPOutputStream(os);
> >                 CachedOutputStream.copyStream(csnew.getInputStream(),
> > zipOutput, 1024);
> >
> >                 cs.close();
> >                 zipOutput.close();
> >                 os.flush();
> >
> >                 message.setContent(OutputStream.class, os);
> >             } catch (IOException ioe) {
> >                 ioe.printStackTrace();
> >             }
> >         } else {
> >             try {
> >                 InputStream is = message.getContent(InputStream.class);
> >                 GZIPInputStream zipInput = new GZIPInputStream(is);
> >                 message.setContent(InputStream.class, zipInput);
> >             } catch (IOException ioe) {
> >                 ioe.printStackTrace();
> >             }
> >         }*/
> >     }
> >
> > 4. updated server.xml:
> > ...
> >     <cxf:bus>
> >         <!--cxf:inInterceptors>
> >             <ref bean="GZIPStream"/>
> >         </cxf:inInterceptors>
> >         <cxf:inFaultInterceptors>
> >             <ref bean="GZIPStream"/>
> >         </cxf:inFaultInterceptors>
> >         <cxf:outInterceptors>
> >             <ref bean="GZIPStream"/>
> >         </cxf:outInterceptors-->
> >         <!--cxf:outFaultInterceptors>
> >              <ref bean="GZIPStream"/>
> >         </cxf:outFaultInterceptors-->
> >     </cxf:bus>
> > ...
> > <jaxws:endpoint id="streamInterceptor"
> > implementor="demo.stream.server.GreeterImpl"
> > address="http://localhost:9000/SoapContext/SoapPort"
> > wsdlLocation="wsdl/hello_world.wsdl"
> > endpointName="e:SoapPort"
> > serviceName="s:SOAPService"
> > xmlns:e="http://apache.org/hello_world_soap_http"
> > xmlns:s="http://apache.org/hello_world_soap_http">
> > <jaxws:features>
> > <bean class="org.apache.cxf.feature.LoggingFeature"/>
> > </jaxws:features>
> >
> > <jaxws:inInterceptors>
> > <ref bean="GZIPStream"/>
> > </jaxws:inInterceptors>
> >
> > <jaxws:outInterceptors>
> > <ref bean="GZIPStream"/>
> > </jaxws:outInterceptors>
> >
> > </jaxws:endpoint>
> >
> >
> > And again, the interceptor is not called when the request is processed at
> > the server side. It is called only when the response is processed on the
> > server side.
> >
> > Thanks
> > Oliver
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
> > Gesendet: Fr 05.09.2008 16:16
> > An: Daniel Kulp; users@cxf.apache.org
> > Betreff: AW: Custom InInterceptor not called
> >
> > Hi Dan
> >
> > I use version 2.0.6.
> >
> > Thanks
> > Oliver
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Daniel Kulp [mailto:dkulp@apache.org]
> > Gesendet: Fr 05.09.2008 16:10
> > An: users@cxf.apache.org
> > Cc: Wulff, Oliver
> > Betreff: Re: Custom InInterceptor not called
> >
> >
> > Oliver,
> >
> > I tried this with the latest 2.2 snapshot code yesterday and it worked
> > fine. I got both messages printed out (true and false) on the console.
> >
> > Can you double check with the 2.1.2 release or let me know what version
> > this affects?
> >
> > Dan
> >
> > On Friday 05 September 2008 7:40:48 am Wulff, Oliver wrote:
> > > Hi there
> > >
> > > I came across the problem that my custom interceptor is added to the
> > > interceptor chain (cxf log message) but handleMessage isn't called. It
> > > works fine if the interceptor is configured for the bean CXFBeanImpl
> > > but it doesn't work if the interceptor is configured in the spring
> > > config as a sub element of the jaxws:endpoint.
> > >
> > > You can easily reproduce this with the demo
> > > "configuration_interceptor".
> > >
> > > 1) update the StreamInterceptor.java to only log that the interceptor
> > > has been called: //TODO
> > >
> > >         boolean isOutbound = false;
> > >         isOutbound = message == message.getExchange().getOutMessage()
> > >
> > >                || message ==
> > >                || message.getExchange().getOutFaultMessage();
> > >
> > >         System.out.println(">>>handleMessage: " + isOutbound);
> > >
> > > 2) update the server.xml to configure the interceptor as an in and out
> > > interceptor in the CXFBusImpl Bean: <bean id="cxf"
> > > class="org.apache.cxf.bus.CXFBusImpl">
> > >         <property name="inInterceptors">
> > >             <list>
> > >                 <ref bean="GZIPStream"/>
> > >             </list>
> > >         </property>
> > >         <property name="outInterceptors">
> > >             <list>
> > >                 <ref bean="GZIPStream"/>
> > >             </list>
> > >         </property>
> > >     </bean>
> > >
> > >
> > > 3) output of the server looks as expected when the client is run:
> > > server:
> > >      [java] Starting Server
> > >      [java] Server ready...
> > >      [java] >>>handleMessage: false
> > >      [java] Executing operation sayHi
> > >
> > >      [java] >>>handleMessage: true
> > >
> > >
> > > 4) then, I've configured the "jaxws:endpoint" Bean in the server.xml:
> > >
> > >     <jaxws:endpoint id="streamInterceptor"
> > >         implementor="demo.stream.server.GreeterImpl"
> > >         address="http://localhost:9000/SoapContext/SoapPort"
> > >         wsdlLocation="wsdl/hello_world.wsdl"
> > >         endpointName="e:SoapPort"
> > >         serviceName="s:SOAPService"
> > >         xmlns:e="http://apache.org/hello_world_soap_http"
> > >         xmlns:s="http://apache.org/hello_world_soap_http">
> > >         <jaxws:features>
> > >             <bean class="org.apache.cxf.feature.LoggingFeature"/>
> > >         </jaxws:features>
> > >
> > >         <jaxws:inInterceptors>
> > >             <ref bean="GZIPStream"/>
> > >         </jaxws:inInterceptors>
> > >
> > >        <jaxws:outInterceptors>
> > >            <ref bean="GZIPStream"/>
> > >        </jaxws:outInterceptors>
> > >
> > >     </jaxws:endpoint>
> > >
> > >
> > > 5) output of the server when the client is run:
> > > server:
> > >      [java] Starting Server
> > >      [java] Server ready...
> > >      [java] Executing operation sayHi
> > >
> > >      [java] >>>handleMessage: true
> > >
> > > handleMessage is NOT called before the request is dispatched to the
> > > implementation.
> > >
> > > Any ideas?
> > >
> > > Thanks
> > > Oliver



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: AW: Custom InInterceptor not called

Posted by Daniel Kulp <dk...@apache.org>.


On Friday 12 September 2008 7:55:33 am Wulff, Oliver wrote:
> Were you able to reproduce the issue?

Well, it works with 2.2 snapshots, but not with 2.1.3 snapshots.   That really 
sucks.   I have NO idea what fixes to 2.2 would have impacted this.   I'll 
dig in.  

Dan



> Thanks
> Oliver
>
>
> -----Ursprüngliche Nachricht-----
> Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
> Gesendet: So 07.09.2008 00:01
> An: users@cxf.apache.org; Daniel Kulp; users@cxf.apache.org
> Betreff: AW: Custom InInterceptor not called
>
> Hi Dan
>
> I give it a try with 2.1.2 but without success.
>
> I've done the following:
>
> 1) updated build.xml:
>   <target name="server" description="run demo server" depends="build">
>     <cxfrun classname="demo.stream.server.Server"
> 	    param1="${basedir}/wsdl/hello_world.wsdl"
> 	    jvmarg1="-Dcxf.config.file=server.xml"/>
>   </target>
>
> 2) copied server.xml to directory configuration_interceptor
>
> 3) updated StreamInterceptor.java:
>     public void handleMessage(Message message) {
>         //TODO
>
>         boolean isOutbound = false;
>         isOutbound = message == message.getExchange().getOutMessage()
>
>                || message == message.getExchange().getOutFaultMessage();
>
> System.out.println("handleMessage. Outbound: " + isOutbound);
>         /*if (isOutbound) {
>             OutputStream os = message.getContent(OutputStream.class);
>             CachedStream cs = new CachedStream();
>             message.setContent(OutputStream.class, cs);
>
>             message.getInterceptorChain().doIntercept(message);
>
>             try {
>                 cs.flush();
>                 CachedOutputStream csnew = (CachedOutputStream) message
>                     .getContent(OutputStream.class);
>                 GZIPOutputStream zipOutput = new GZIPOutputStream(os);
>                 CachedOutputStream.copyStream(csnew.getInputStream(),
> zipOutput, 1024);
>
>                 cs.close();
>                 zipOutput.close();
>                 os.flush();
>
>                 message.setContent(OutputStream.class, os);
>             } catch (IOException ioe) {
>                 ioe.printStackTrace();
>             }
>         } else {
>             try {
>                 InputStream is = message.getContent(InputStream.class);
>                 GZIPInputStream zipInput = new GZIPInputStream(is);
>                 message.setContent(InputStream.class, zipInput);
>             } catch (IOException ioe) {
>                 ioe.printStackTrace();
>             }
>         }*/
>     }
>
> 4. updated server.xml:
> ...
>     <cxf:bus>
>         <!--cxf:inInterceptors>
>             <ref bean="GZIPStream"/>
>         </cxf:inInterceptors>
>         <cxf:inFaultInterceptors>
>             <ref bean="GZIPStream"/>
>         </cxf:inFaultInterceptors>
>         <cxf:outInterceptors>
>             <ref bean="GZIPStream"/>
>         </cxf:outInterceptors-->
>         <!--cxf:outFaultInterceptors>
>              <ref bean="GZIPStream"/>
>         </cxf:outFaultInterceptors-->
>     </cxf:bus>
> ...
> <jaxws:endpoint id="streamInterceptor"
> implementor="demo.stream.server.GreeterImpl"
> address="http://localhost:9000/SoapContext/SoapPort"
> wsdlLocation="wsdl/hello_world.wsdl"
> endpointName="e:SoapPort"
> serviceName="s:SOAPService"
> xmlns:e="http://apache.org/hello_world_soap_http"
> xmlns:s="http://apache.org/hello_world_soap_http">
> <jaxws:features>
> <bean class="org.apache.cxf.feature.LoggingFeature"/>
> </jaxws:features>
>
> <jaxws:inInterceptors>
> <ref bean="GZIPStream"/>
> </jaxws:inInterceptors>
>
> <jaxws:outInterceptors>
> <ref bean="GZIPStream"/>
> </jaxws:outInterceptors>
>
> </jaxws:endpoint>
>
>
> And again, the interceptor is not called when the request is processed at
> the server side. It is called only when the response is processed on the
> server side.
>
> Thanks
> Oliver
>
>
> -----Ursprüngliche Nachricht-----
> Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
> Gesendet: Fr 05.09.2008 16:16
> An: Daniel Kulp; users@cxf.apache.org
> Betreff: AW: Custom InInterceptor not called
>
> Hi Dan
>
> I use version 2.0.6.
>
> Thanks
> Oliver
>
>
> -----Ursprüngliche Nachricht-----
> Von: Daniel Kulp [mailto:dkulp@apache.org]
> Gesendet: Fr 05.09.2008 16:10
> An: users@cxf.apache.org
> Cc: Wulff, Oliver
> Betreff: Re: Custom InInterceptor not called
>
>
> Oliver,
>
> I tried this with the latest 2.2 snapshot code yesterday and it worked
> fine. I got both messages printed out (true and false) on the console.
>
> Can you double check with the 2.1.2 release or let me know what version
> this affects?
>
> Dan
>
> On Friday 05 September 2008 7:40:48 am Wulff, Oliver wrote:
> > Hi there
> >
> > I came across the problem that my custom interceptor is added to the
> > interceptor chain (cxf log message) but handleMessage isn't called. It
> > works fine if the interceptor is configured for the bean CXFBeanImpl but
> > it doesn't work if the interceptor is configured in the spring config as
> > a sub element of the jaxws:endpoint.
> >
> > You can easily reproduce this with the demo "configuration_interceptor".
> >
> > 1) update the StreamInterceptor.java to only log that the interceptor has
> > been called: //TODO
> >
> >         boolean isOutbound = false;
> >         isOutbound = message == message.getExchange().getOutMessage()
> >
> >                || message == message.getExchange().getOutFaultMessage();
> >
> >         System.out.println(">>>handleMessage: " + isOutbound);
> >
> > 2) update the server.xml to configure the interceptor as an in and out
> > interceptor in the CXFBusImpl Bean: <bean id="cxf"
> > class="org.apache.cxf.bus.CXFBusImpl">
> >         <property name="inInterceptors">
> >             <list>
> >                 <ref bean="GZIPStream"/>
> >             </list>
> >         </property>
> >         <property name="outInterceptors">
> >             <list>
> >                 <ref bean="GZIPStream"/>
> >             </list>
> >         </property>
> >     </bean>
> >
> >
> > 3) output of the server looks as expected when the client is run:
> > server:
> >      [java] Starting Server
> >      [java] Server ready...
> >      [java] >>>handleMessage: false
> >      [java] Executing operation sayHi
> >
> >      [java] >>>handleMessage: true
> >
> >
> > 4) then, I've configured the "jaxws:endpoint" Bean in the server.xml:
> >
> >     <jaxws:endpoint id="streamInterceptor"
> >         implementor="demo.stream.server.GreeterImpl"
> >         address="http://localhost:9000/SoapContext/SoapPort"
> >         wsdlLocation="wsdl/hello_world.wsdl"
> >         endpointName="e:SoapPort"
> >         serviceName="s:SOAPService"
> >         xmlns:e="http://apache.org/hello_world_soap_http"
> >         xmlns:s="http://apache.org/hello_world_soap_http">
> >         <jaxws:features>
> >             <bean class="org.apache.cxf.feature.LoggingFeature"/>
> >         </jaxws:features>
> >
> >         <jaxws:inInterceptors>
> >             <ref bean="GZIPStream"/>
> >         </jaxws:inInterceptors>
> >
> >        <jaxws:outInterceptors>
> >            <ref bean="GZIPStream"/>
> >        </jaxws:outInterceptors>
> >
> >     </jaxws:endpoint>
> >
> >
> > 5) output of the server when the client is run:
> > server:
> >      [java] Starting Server
> >      [java] Server ready...
> >      [java] Executing operation sayHi
> >
> >      [java] >>>handleMessage: true
> >
> > handleMessage is NOT called before the request is dispatched to the
> > implementation.
> >
> > Any ideas?
> >
> > Thanks
> > Oliver



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

AW: Custom InInterceptor not called

Posted by "Wulff, Oliver" <Ol...@iona.com>.
Were you able to reproduce the issue?

Thanks
Oliver


-----Ursprüngliche Nachricht-----
Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
Gesendet: So 07.09.2008 00:01
An: users@cxf.apache.org; Daniel Kulp; users@cxf.apache.org
Betreff: AW: Custom InInterceptor not called
 
Hi Dan

I give it a try with 2.1.2 but without success.

I've done the following:

1) updated build.xml:
  <target name="server" description="run demo server" depends="build">
    <cxfrun classname="demo.stream.server.Server"
	    param1="${basedir}/wsdl/hello_world.wsdl"
	    jvmarg1="-Dcxf.config.file=server.xml"/>
  </target>

2) copied server.xml to directory configuration_interceptor

3) updated StreamInterceptor.java:
    public void handleMessage(Message message) {
        //TODO

        boolean isOutbound = false;
        isOutbound = message == message.getExchange().getOutMessage()
               || message == message.getExchange().getOutFaultMessage();
System.out.println("handleMessage. Outbound: " + isOutbound);
        /*if (isOutbound) {
            OutputStream os = message.getContent(OutputStream.class);
            CachedStream cs = new CachedStream();
            message.setContent(OutputStream.class, cs);
            
            message.getInterceptorChain().doIntercept(message);

            try {
                cs.flush();
                CachedOutputStream csnew = (CachedOutputStream) message
                    .getContent(OutputStream.class);
                GZIPOutputStream zipOutput = new GZIPOutputStream(os);
                CachedOutputStream.copyStream(csnew.getInputStream(), zipOutput, 1024);

                cs.close();
                zipOutput.close();
                os.flush();

                message.setContent(OutputStream.class, os);
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
        } else {
            try {
                InputStream is = message.getContent(InputStream.class);
                GZIPInputStream zipInput = new GZIPInputStream(is);
                message.setContent(InputStream.class, zipInput);
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
        }*/
    }

4. updated server.xml:
...
    <cxf:bus>
        <!--cxf:inInterceptors>
            <ref bean="GZIPStream"/>
        </cxf:inInterceptors>
        <cxf:inFaultInterceptors>
            <ref bean="GZIPStream"/>            
        </cxf:inFaultInterceptors>
        <cxf:outInterceptors>            
            <ref bean="GZIPStream"/>        
        </cxf:outInterceptors-->
        <!--cxf:outFaultInterceptors>           
             <ref bean="GZIPStream"/>
        </cxf:outFaultInterceptors-->
    </cxf:bus>
...
<jaxws:endpoint id="streamInterceptor"
implementor="demo.stream.server.GreeterImpl"
address="http://localhost:9000/SoapContext/SoapPort"
wsdlLocation="wsdl/hello_world.wsdl"
endpointName="e:SoapPort"
serviceName="s:SOAPService"
xmlns:e="http://apache.org/hello_world_soap_http"
xmlns:s="http://apache.org/hello_world_soap_http">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature"/>
</jaxws:features>

<jaxws:inInterceptors>
<ref bean="GZIPStream"/>
</jaxws:inInterceptors>

<jaxws:outInterceptors>
<ref bean="GZIPStream"/>
</jaxws:outInterceptors>

</jaxws:endpoint>


And again, the interceptor is not called when the request is processed at the server side. It is called only when the response is processed on the server side.

Thanks
Oliver


-----Ursprüngliche Nachricht-----
Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
Gesendet: Fr 05.09.2008 16:16
An: Daniel Kulp; users@cxf.apache.org
Betreff: AW: Custom InInterceptor not called
 
Hi Dan

I use version 2.0.6.

Thanks
Oliver


-----Ursprüngliche Nachricht-----
Von: Daniel Kulp [mailto:dkulp@apache.org]
Gesendet: Fr 05.09.2008 16:10
An: users@cxf.apache.org
Cc: Wulff, Oliver
Betreff: Re: Custom InInterceptor not called
 

Oliver, 

I tried this with the latest 2.2 snapshot code yesterday and it worked fine.  
I got both messages printed out (true and false) on the console.

Can you double check with the 2.1.2 release or let me know what version this 
affects?

Dan

On Friday 05 September 2008 7:40:48 am Wulff, Oliver wrote:
> Hi there
>
> I came across the problem that my custom interceptor is added to the
> interceptor chain (cxf log message) but handleMessage isn't called. It
> works fine if the interceptor is configured for the bean CXFBeanImpl but it
> doesn't work if the interceptor is configured in the spring config as a sub
> element of the jaxws:endpoint.
>
> You can easily reproduce this with the demo "configuration_interceptor".
>
> 1) update the StreamInterceptor.java to only log that the interceptor has
> been called: //TODO
>
>         boolean isOutbound = false;
>         isOutbound = message == message.getExchange().getOutMessage()
>
>                || message == message.getExchange().getOutFaultMessage();
>
>         System.out.println(">>>handleMessage: " + isOutbound);
>
> 2) update the server.xml to configure the interceptor as an in and out
> interceptor in the CXFBusImpl Bean: <bean id="cxf"
> class="org.apache.cxf.bus.CXFBusImpl">
>         <property name="inInterceptors">
>             <list>
>                 <ref bean="GZIPStream"/>
>             </list>
>         </property>
>         <property name="outInterceptors">
>             <list>
>                 <ref bean="GZIPStream"/>
>             </list>
>         </property>
>     </bean>
>
>
> 3) output of the server looks as expected when the client is run:
> server:
>      [java] Starting Server
>      [java] Server ready...
>      [java] >>>handleMessage: false
>      [java] Executing operation sayHi
>
>      [java] >>>handleMessage: true
>
>
> 4) then, I've configured the "jaxws:endpoint" Bean in the server.xml:
>
>     <jaxws:endpoint id="streamInterceptor"
>         implementor="demo.stream.server.GreeterImpl"
>         address="http://localhost:9000/SoapContext/SoapPort"
>         wsdlLocation="wsdl/hello_world.wsdl"
>         endpointName="e:SoapPort"
>         serviceName="s:SOAPService"
>         xmlns:e="http://apache.org/hello_world_soap_http"
>         xmlns:s="http://apache.org/hello_world_soap_http">
>         <jaxws:features>
>             <bean class="org.apache.cxf.feature.LoggingFeature"/>
>         </jaxws:features>
>
>         <jaxws:inInterceptors>
>             <ref bean="GZIPStream"/>
>         </jaxws:inInterceptors>
>
>        <jaxws:outInterceptors>
>            <ref bean="GZIPStream"/>
>        </jaxws:outInterceptors>
>
>     </jaxws:endpoint>
>
>
> 5) output of the server when the client is run:
> server:
>      [java] Starting Server
>      [java] Server ready...
>      [java] Executing operation sayHi
>
>      [java] >>>handleMessage: true
>
> handleMessage is NOT called before the request is dispatched to the
> implementation.
>
> Any ideas?
>
> Thanks
> Oliver



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog




AW: Custom InInterceptor not called

Posted by "Wulff, Oliver" <Ol...@iona.com>.
Hi Dan

I give it a try with 2.1.2 but without success.

I've done the following:

1) updated build.xml:
  <target name="server" description="run demo server" depends="build">
    <cxfrun classname="demo.stream.server.Server"
	    param1="${basedir}/wsdl/hello_world.wsdl"
	    jvmarg1="-Dcxf.config.file=server.xml"/>
  </target>

2) copied server.xml to directory configuration_interceptor

3) updated StreamInterceptor.java:
    public void handleMessage(Message message) {
        //TODO

        boolean isOutbound = false;
        isOutbound = message == message.getExchange().getOutMessage()
               || message == message.getExchange().getOutFaultMessage();
System.out.println("handleMessage. Outbound: " + isOutbound);
        /*if (isOutbound) {
            OutputStream os = message.getContent(OutputStream.class);
            CachedStream cs = new CachedStream();
            message.setContent(OutputStream.class, cs);
            
            message.getInterceptorChain().doIntercept(message);

            try {
                cs.flush();
                CachedOutputStream csnew = (CachedOutputStream) message
                    .getContent(OutputStream.class);
                GZIPOutputStream zipOutput = new GZIPOutputStream(os);
                CachedOutputStream.copyStream(csnew.getInputStream(), zipOutput, 1024);

                cs.close();
                zipOutput.close();
                os.flush();

                message.setContent(OutputStream.class, os);
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
        } else {
            try {
                InputStream is = message.getContent(InputStream.class);
                GZIPInputStream zipInput = new GZIPInputStream(is);
                message.setContent(InputStream.class, zipInput);
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
        }*/
    }

4. updated server.xml:
...
    <cxf:bus>
        <!--cxf:inInterceptors>
            <ref bean="GZIPStream"/>
        </cxf:inInterceptors>
        <cxf:inFaultInterceptors>
            <ref bean="GZIPStream"/>            
        </cxf:inFaultInterceptors>
        <cxf:outInterceptors>            
            <ref bean="GZIPStream"/>        
        </cxf:outInterceptors-->
        <!--cxf:outFaultInterceptors>           
             <ref bean="GZIPStream"/>
        </cxf:outFaultInterceptors-->
    </cxf:bus>
...
<jaxws:endpoint id="streamInterceptor"
implementor="demo.stream.server.GreeterImpl"
address="http://localhost:9000/SoapContext/SoapPort"
wsdlLocation="wsdl/hello_world.wsdl"
endpointName="e:SoapPort"
serviceName="s:SOAPService"
xmlns:e="http://apache.org/hello_world_soap_http"
xmlns:s="http://apache.org/hello_world_soap_http">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature"/>
</jaxws:features>

<jaxws:inInterceptors>
<ref bean="GZIPStream"/>
</jaxws:inInterceptors>

<jaxws:outInterceptors>
<ref bean="GZIPStream"/>
</jaxws:outInterceptors>

</jaxws:endpoint>


And again, the interceptor is not called when the request is processed at the server side. It is called only when the response is processed on the server side.

Thanks
Oliver


-----Ursprüngliche Nachricht-----
Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
Gesendet: Fr 05.09.2008 16:16
An: Daniel Kulp; users@cxf.apache.org
Betreff: AW: Custom InInterceptor not called
 
Hi Dan

I use version 2.0.6.

Thanks
Oliver


-----Ursprüngliche Nachricht-----
Von: Daniel Kulp [mailto:dkulp@apache.org]
Gesendet: Fr 05.09.2008 16:10
An: users@cxf.apache.org
Cc: Wulff, Oliver
Betreff: Re: Custom InInterceptor not called
 

Oliver, 

I tried this with the latest 2.2 snapshot code yesterday and it worked fine.  
I got both messages printed out (true and false) on the console.

Can you double check with the 2.1.2 release or let me know what version this 
affects?

Dan

On Friday 05 September 2008 7:40:48 am Wulff, Oliver wrote:
> Hi there
>
> I came across the problem that my custom interceptor is added to the
> interceptor chain (cxf log message) but handleMessage isn't called. It
> works fine if the interceptor is configured for the bean CXFBeanImpl but it
> doesn't work if the interceptor is configured in the spring config as a sub
> element of the jaxws:endpoint.
>
> You can easily reproduce this with the demo "configuration_interceptor".
>
> 1) update the StreamInterceptor.java to only log that the interceptor has
> been called: //TODO
>
>         boolean isOutbound = false;
>         isOutbound = message == message.getExchange().getOutMessage()
>
>                || message == message.getExchange().getOutFaultMessage();
>
>         System.out.println(">>>handleMessage: " + isOutbound);
>
> 2) update the server.xml to configure the interceptor as an in and out
> interceptor in the CXFBusImpl Bean: <bean id="cxf"
> class="org.apache.cxf.bus.CXFBusImpl">
>         <property name="inInterceptors">
>             <list>
>                 <ref bean="GZIPStream"/>
>             </list>
>         </property>
>         <property name="outInterceptors">
>             <list>
>                 <ref bean="GZIPStream"/>
>             </list>
>         </property>
>     </bean>
>
>
> 3) output of the server looks as expected when the client is run:
> server:
>      [java] Starting Server
>      [java] Server ready...
>      [java] >>>handleMessage: false
>      [java] Executing operation sayHi
>
>      [java] >>>handleMessage: true
>
>
> 4) then, I've configured the "jaxws:endpoint" Bean in the server.xml:
>
>     <jaxws:endpoint id="streamInterceptor"
>         implementor="demo.stream.server.GreeterImpl"
>         address="http://localhost:9000/SoapContext/SoapPort"
>         wsdlLocation="wsdl/hello_world.wsdl"
>         endpointName="e:SoapPort"
>         serviceName="s:SOAPService"
>         xmlns:e="http://apache.org/hello_world_soap_http"
>         xmlns:s="http://apache.org/hello_world_soap_http">
>         <jaxws:features>
>             <bean class="org.apache.cxf.feature.LoggingFeature"/>
>         </jaxws:features>
>
>         <jaxws:inInterceptors>
>             <ref bean="GZIPStream"/>
>         </jaxws:inInterceptors>
>
>        <jaxws:outInterceptors>
>            <ref bean="GZIPStream"/>
>        </jaxws:outInterceptors>
>
>     </jaxws:endpoint>
>
>
> 5) output of the server when the client is run:
> server:
>      [java] Starting Server
>      [java] Server ready...
>      [java] Executing operation sayHi
>
>      [java] >>>handleMessage: true
>
> handleMessage is NOT called before the request is dispatched to the
> implementation.
>
> Any ideas?
>
> Thanks
> Oliver



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog



AW: Custom InInterceptor not called

Posted by "Wulff, Oliver" <Ol...@iona.com>.
Hi Dan

I use version 2.0.6.

Thanks
Oliver


-----Ursprüngliche Nachricht-----
Von: Daniel Kulp [mailto:dkulp@apache.org]
Gesendet: Fr 05.09.2008 16:10
An: users@cxf.apache.org
Cc: Wulff, Oliver
Betreff: Re: Custom InInterceptor not called
 

Oliver, 

I tried this with the latest 2.2 snapshot code yesterday and it worked fine.  
I got both messages printed out (true and false) on the console.

Can you double check with the 2.1.2 release or let me know what version this 
affects?

Dan

On Friday 05 September 2008 7:40:48 am Wulff, Oliver wrote:
> Hi there
>
> I came across the problem that my custom interceptor is added to the
> interceptor chain (cxf log message) but handleMessage isn't called. It
> works fine if the interceptor is configured for the bean CXFBeanImpl but it
> doesn't work if the interceptor is configured in the spring config as a sub
> element of the jaxws:endpoint.
>
> You can easily reproduce this with the demo "configuration_interceptor".
>
> 1) update the StreamInterceptor.java to only log that the interceptor has
> been called: //TODO
>
>         boolean isOutbound = false;
>         isOutbound = message == message.getExchange().getOutMessage()
>
>                || message == message.getExchange().getOutFaultMessage();
>
>         System.out.println(">>>handleMessage: " + isOutbound);
>
> 2) update the server.xml to configure the interceptor as an in and out
> interceptor in the CXFBusImpl Bean: <bean id="cxf"
> class="org.apache.cxf.bus.CXFBusImpl">
>         <property name="inInterceptors">
>             <list>
>                 <ref bean="GZIPStream"/>
>             </list>
>         </property>
>         <property name="outInterceptors">
>             <list>
>                 <ref bean="GZIPStream"/>
>             </list>
>         </property>
>     </bean>
>
>
> 3) output of the server looks as expected when the client is run:
> server:
>      [java] Starting Server
>      [java] Server ready...
>      [java] >>>handleMessage: false
>      [java] Executing operation sayHi
>
>      [java] >>>handleMessage: true
>
>
> 4) then, I've configured the "jaxws:endpoint" Bean in the server.xml:
>
>     <jaxws:endpoint id="streamInterceptor"
>         implementor="demo.stream.server.GreeterImpl"
>         address="http://localhost:9000/SoapContext/SoapPort"
>         wsdlLocation="wsdl/hello_world.wsdl"
>         endpointName="e:SoapPort"
>         serviceName="s:SOAPService"
>         xmlns:e="http://apache.org/hello_world_soap_http"
>         xmlns:s="http://apache.org/hello_world_soap_http">
>         <jaxws:features>
>             <bean class="org.apache.cxf.feature.LoggingFeature"/>
>         </jaxws:features>
>
>         <jaxws:inInterceptors>
>             <ref bean="GZIPStream"/>
>         </jaxws:inInterceptors>
>
>        <jaxws:outInterceptors>
>            <ref bean="GZIPStream"/>
>        </jaxws:outInterceptors>
>
>     </jaxws:endpoint>
>
>
> 5) output of the server when the client is run:
> server:
>      [java] Starting Server
>      [java] Server ready...
>      [java] Executing operation sayHi
>
>      [java] >>>handleMessage: true
>
> handleMessage is NOT called before the request is dispatched to the
> implementation.
>
> Any ideas?
>
> Thanks
> Oliver



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog


Re: Custom InInterceptor not called

Posted by Daniel Kulp <dk...@apache.org>.
Oliver, 

I tried this with the latest 2.2 snapshot code yesterday and it worked fine.  
I got both messages printed out (true and false) on the console.

Can you double check with the 2.1.2 release or let me know what version this 
affects?

Dan

On Friday 05 September 2008 7:40:48 am Wulff, Oliver wrote:
> Hi there
>
> I came across the problem that my custom interceptor is added to the
> interceptor chain (cxf log message) but handleMessage isn't called. It
> works fine if the interceptor is configured for the bean CXFBeanImpl but it
> doesn't work if the interceptor is configured in the spring config as a sub
> element of the jaxws:endpoint.
>
> You can easily reproduce this with the demo "configuration_interceptor".
>
> 1) update the StreamInterceptor.java to only log that the interceptor has
> been called: //TODO
>
>         boolean isOutbound = false;
>         isOutbound = message == message.getExchange().getOutMessage()
>
>                || message == message.getExchange().getOutFaultMessage();
>
>         System.out.println(">>>handleMessage: " + isOutbound);
>
> 2) update the server.xml to configure the interceptor as an in and out
> interceptor in the CXFBusImpl Bean: <bean id="cxf"
> class="org.apache.cxf.bus.CXFBusImpl">
>         <property name="inInterceptors">
>             <list>
>                 <ref bean="GZIPStream"/>
>             </list>
>         </property>
>         <property name="outInterceptors">
>             <list>
>                 <ref bean="GZIPStream"/>
>             </list>
>         </property>
>     </bean>
>
>
> 3) output of the server looks as expected when the client is run:
> server:
>      [java] Starting Server
>      [java] Server ready...
>      [java] >>>handleMessage: false
>      [java] Executing operation sayHi
>
>      [java] >>>handleMessage: true
>
>
> 4) then, I've configured the "jaxws:endpoint" Bean in the server.xml:
>
>     <jaxws:endpoint id="streamInterceptor"
>         implementor="demo.stream.server.GreeterImpl"
>         address="http://localhost:9000/SoapContext/SoapPort"
>         wsdlLocation="wsdl/hello_world.wsdl"
>         endpointName="e:SoapPort"
>         serviceName="s:SOAPService"
>         xmlns:e="http://apache.org/hello_world_soap_http"
>         xmlns:s="http://apache.org/hello_world_soap_http">
>         <jaxws:features>
>             <bean class="org.apache.cxf.feature.LoggingFeature"/>
>         </jaxws:features>
>
>         <jaxws:inInterceptors>
>             <ref bean="GZIPStream"/>
>         </jaxws:inInterceptors>
>
>        <jaxws:outInterceptors>
>            <ref bean="GZIPStream"/>
>        </jaxws:outInterceptors>
>
>     </jaxws:endpoint>
>
>
> 5) output of the server when the client is run:
> server:
>      [java] Starting Server
>      [java] Server ready...
>      [java] Executing operation sayHi
>
>      [java] >>>handleMessage: true
>
> handleMessage is NOT called before the request is dispatched to the
> implementation.
>
> Any ideas?
>
> Thanks
> Oliver



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog