I resolved my problem !
In fact, my jboss installation was using jboss-ws native WS-stack, and so the 
Provider class chose org.jboss.* implementations, so my interceptors were never 
called ...



-------- Message d'origine--------
De: Anthony Dahanne [mailto:[email protected]]
Date: mar. 11/08/2009 14:54
À: [email protected]
Objet : [custom interceptors not loaded in Jboss but loaded OK in standalone 
client]
 
Hi,
I'm using wsdl2java functionality from CXF 2.2.1, to generate a Java client.
I've been able to successfully generate the Java classes including the service 
of my WSDL and associated XSDs.
I have also created 2 interceptors, to log the XML streams in & out.
I'm currently using the configuration file method, to chain my interceptor to 
the bus, my cxf.xml file is this one :

cxf.xml
<beans xmlns="http://www.springframework.org/schema/beans"; 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
      xmlns:cxf="http://cxf.apache.org/core"; 
      xsi:schemaLocation=" 
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd 
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";> 
    <bean id="logInbound" class="mypackage.interceptors.RequestInterceptor"/> 
    <bean id="logOutbound" class="mypackage.interceptors.ResponseInterceptor"/> 
 
    <cxf:bus> 
        <cxf:inInterceptors> 
            <ref bean="logInbound"/> 
        </cxf:inInterceptors> 
        <cxf:outInterceptors> 
            <ref bean="logOutbound"/> 
        </cxf:outInterceptors> 
        <cxf:inFaultInterceptors> 
            <ref bean="logOutbound"/> 
        </cxf:inFaultInterceptors> 
    </cxf:bus>  
</beans> 

These interceptors work fine in a standlone client app (in a jar), but when I 
deploy this jar inside a demo app (war) in Jboss 4.2, even if the demo can 
access the webservice and return the response, it does not load the 
interceptors, and ignore them.
I've been thinking of a classpath problem with the cxf.xml file, so I tried to 
copy it everywhere (!), and it did not solve my problem.
Finally, I used annotations in the client class, it still works in the 
standalone jar, still doesn't in the war...

@org.apache.cxf.interceptor.InInterceptors(interceptors = { 
"mypackage.interceptors.RequestInterceptor" })
@org.apache.cxf.interceptor.InFaultInterceptors(interceptors = { 
"mypackage.interceptors.ResponseInterceptor" })
@org.apache.cxf.interceptor.OutInterceptors(interceptors = { 
"mypackage.interceptors.ResponseInterceptor" })

Did I forget something when deploying to my Jboss app server ?

Thank you for you help !
ANthony



Reply via email to