cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: AW: Custom InInterceptor not called
Date Fri, 12 Sep 2008 18:47:32 GMT

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

Mime
View raw message