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:[EMAIL PROTECTED]
> Gesendet: So 07.09.2008 00:01
> An: [email protected]; Daniel Kulp; [email protected]
> 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:[EMAIL PROTECTED]
> Gesendet: Fr 05.09.2008 16:16
> An: Daniel Kulp; [email protected]
> Betreff: AW: Custom InInterceptor not called
>
> Hi Dan
>
> I use version 2.0.6.
>
> Thanks
> Oliver
>
>
> -----Ursprüngliche Nachricht-----
> Von: Daniel Kulp [mailto:[EMAIL PROTECTED]
> Gesendet: Fr 05.09.2008 16:10
> An: [email protected]
> 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
[EMAIL PROTECTED]
http://www.dankulp.com/blog