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

Reply via email to