You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Thorsten Jungblut <ul...@netcorner.org> on 2007/12/12 20:37:55 UTC

Interceptor configuration not working

Hi,

i'm using CXF in Tomcat 6.0. I deployed a simple JAX-WS Webservice along 
with CXF and tried to add an interceptor.

The webservice itself is working perfeclty but though my interceptor gets 
instantiated, it never get invoked.

I only use one configuration file, cxf-servlet.xml under 
WEB-INF/ with the following contents:

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">

<bean id="ServiceInterceptor" name="ServiceInterceptor" 
class="toy.ServiceInterceptor"/>

<jaxws:endpoint id="classImpl1"
    implementor="toy.WebService1"
    address="/WebService1"
    />
<jaxws:endpoint id="classImpl2"
    implementor="toy.WebService2"
    address="/WebService2"
    />
    
<!-- cxf:bus>
  <cxf:inInterceptors>
    <ref bean="ServiceInterceptor"/>
  </cxf:inInterceptors>
</cxf:bus-->

<bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
        <property name="inInterceptors">
            <list>
                <ref bean="ServiceInterceptor"/>
            </list>
        </property>
</bean>
</beans>



I already tried both, the cxf:bus element and the bean-element, nothing 
seems to help..

Did i miss something?

Best regards
T. Jungblut

Re: Interceptor configuration not working

Posted by Glen Mazza <gl...@verizon.net>.
Am Samstag, den 15.12.2007, 06:12 -0800 schrieb Willem2:
> Oh, you can't do any configuration on the bus within the cxf-servlet.xml.
> Because when CXFServlet loads the cxf-servlet.xml the bus has already been
> loaded.
> 
> You can use the beans.xml to do some configuration first. You can find the
> example in the CXF kit's samples\java_first_spring_support
> 

AFAICT that sample[1] doesn't do any bus configuration though.

I think we've been having users use the cxf.xml file for bus
configuration[1], keeping service config in the beans.xml or
cxf-servlet.xml, correct?  Or can the Spring application context file
(unlike the cxf-servlet.xml file) do *both* service and bus
configuration?

Thanks,
Glen

[1]
http://cwiki.apache.org/confluence/display/CXF20DOC/Configuration#Configuration-Serverconfigurationfiles





> Willem.
> 
> 
> Thorsten Jungblut wrote:
> > 
> > Hi,
> > 
> > i'm using CXF in Tomcat 6.0. I deployed a simple JAX-WS Webservice along 
> > with CXF and tried to add an interceptor.
> > 
> > The webservice itself is working perfeclty but though my interceptor gets 
> > instantiated, it never get invoked.
> > 
> > I only use one configuration file, cxf-servlet.xml under 
> > WEB-INF/ with the following contents:
> > 
> > <beans xmlns="http://www.springframework.org/schema/beans"
> > 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> > 	xmlns:cxf="http://cxf.apache.org/core"
> > 	xsi:schemaLocation="
> > http://www.springframework.org/schema/beans 
> > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> > http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> > http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
> > 
> > <bean id="ServiceInterceptor" name="ServiceInterceptor" 
> > class="toy.ServiceInterceptor"/>
> > 
> > <jaxws:endpoint id="classImpl1"
> >     implementor="toy.WebService1"
> >     address="/WebService1"
> >     />
> > <jaxws:endpoint id="classImpl2"
> >     implementor="toy.WebService2"
> >     address="/WebService2"
> >     />
> >     
> > <!-- cxf:bus>
> >   <cxf:inInterceptors>
> >     <ref bean="ServiceInterceptor"/>
> >   </cxf:inInterceptors>
> > </cxf:bus-->
> > 
> > <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
> >         <property name="inInterceptors">
> >             <list>
> >                 <ref bean="ServiceInterceptor"/>
> >             </list>
> >         </property>
> > </bean>
> > </beans>
> > 
> > 
> > 
> > I already tried both, the cxf:bus element and the bean-element, nothing 
> > seems to help..
> > 
> > Did i miss something?
> > 
> > Best regards
> > T. Jungblut
> > 
> > 
> 


Re: Interceptor configuration not working

Posted by Willem2 <ni...@iona.com>.
Oh, you can't do any configuration on the bus within the cxf-servlet.xml.
Because when CXFServlet loads the cxf-servlet.xml the bus has already been
loaded.

You can use the beans.xml to do some configuration first. You can find the
example in the CXF kit's samples\java_first_spring_support

Willem.


Thorsten Jungblut wrote:
> 
> Hi,
> 
> i'm using CXF in Tomcat 6.0. I deployed a simple JAX-WS Webservice along 
> with CXF and tried to add an interceptor.
> 
> The webservice itself is working perfeclty but though my interceptor gets 
> instantiated, it never get invoked.
> 
> I only use one configuration file, cxf-servlet.xml under 
> WEB-INF/ with the following contents:
> 
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans 
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
> 
> <bean id="ServiceInterceptor" name="ServiceInterceptor" 
> class="toy.ServiceInterceptor"/>
> 
> <jaxws:endpoint id="classImpl1"
>     implementor="toy.WebService1"
>     address="/WebService1"
>     />
> <jaxws:endpoint id="classImpl2"
>     implementor="toy.WebService2"
>     address="/WebService2"
>     />
>     
> <!-- cxf:bus>
>   <cxf:inInterceptors>
>     <ref bean="ServiceInterceptor"/>
>   </cxf:inInterceptors>
> </cxf:bus-->
> 
> <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
>         <property name="inInterceptors">
>             <list>
>                 <ref bean="ServiceInterceptor"/>
>             </list>
>         </property>
> </bean>
> </beans>
> 
> 
> 
> I already tried both, the cxf:bus element and the bean-element, nothing 
> seems to help..
> 
> Did i miss something?
> 
> Best regards
> T. Jungblut
> 
> 

-- 
View this message in context: http://www.nabble.com/Interceptor-configuration-not-working-tp14300173p14351135.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Interceptor configuration not working

Posted by Jim Ma <em...@iona.com>.
Hi ,
You can set the log level to FINE [1]  to see if this interceptor is 
really added to the interceptor chain .
[1] http://cwiki.apache.org/CXF20DOC/debugging.html

Regards
Jim

Thorsten Jungblut wrote:
> Hi,
>
> i'm using CXF in Tomcat 6.0. I deployed a simple JAX-WS Webservice along 
> with CXF and tried to add an interceptor.
>
> The webservice itself is working perfeclty but though my interceptor gets 
> instantiated, it never get invoked.
>
> I only use one configuration file, cxf-servlet.xml under 
> WEB-INF/ with the following contents:
>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans 
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
>
> <bean id="ServiceInterceptor" name="ServiceInterceptor" 
> class="toy.ServiceInterceptor"/>
>
> <jaxws:endpoint id="classImpl1"
>     implementor="toy.WebService1"
>     address="/WebService1"
>     />
> <jaxws:endpoint id="classImpl2"
>     implementor="toy.WebService2"
>     address="/WebService2"
>     />
>     
> <!-- cxf:bus>
>   <cxf:inInterceptors>
>     <ref bean="ServiceInterceptor"/>
>   </cxf:inInterceptors>
> </cxf:bus-->
>
> <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
>         <property name="inInterceptors">
>             <list>
>                 <ref bean="ServiceInterceptor"/>
>             </list>
>         </property>
> </bean>
> </beans>
>
>
>
> I already tried both, the cxf:bus element and the bean-element, nothing 
> seems to help..
>
> Did i miss something?
>
> Best regards
> T. Jungblut
>
>