You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Rafal Janik <ra...@softwaremind.pl> on 2012/11/13 10:11:11 UTC

Re: One interceptor for all cxf calls

Hi,

Still without any progress here...
I have no idea what I'm doing wrong, here you can find my changes :

    My conf dir:

    rafal@rafal-dell:~/bin/apache-servicemix-3.4.0$ tree conf/
    conf/
    ├── activemq.xml
    ├── busCfg2.xml
    ├── busCfg.xml
    ├── component.properties
    ├── groups.properties
    ├── jmx.xml
    ├── jndi.properties
    ├── jndi.xml
    ├── keystore.jks
    ├── log4j.xml
    ├── login.properties
    ├── security.xml
    ├── servicemix.conf
    ├── servicemix-cxf-bc.cfg
    ├── servicemix.properties
    ├── servicemix.xml
    ├── tx.xml
    ├── users-credentials.properties
    └── users-passwords.properties



servicemix-cxf-bc.cfg file:

    rafal@rafal-dell:~/bin/apache-servicemix-3.4.0$ cat
    conf/servicemix-cxf-bc.cfg
    busCfg=busCfg.xml


and here I was trying to import two busCfg  configurations:

1.

    rafal@rafal-dell:~/bin/apache-servicemix-3.4.0$ cat conf/busCfg.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://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">

         <bean id="logInbound" class="pl.test.TestInInterceptor"/>
         <bean id="logOutbound" class="pl.test.TestOutInterceptor"/>
    <cxf:bus>
    <cxf:inInterceptors>
                 <ref bean="logInbound"/>
    </cxf:inInterceptors>
    <cxf:outInterceptors>
                 <ref bean="logOutbound"/>
    </cxf:outInterceptors>
    </cxf:bus>
    </beans>


2. rafal@rafal-dell:~/bin/apache-servicemix-3.4.0$ cat conf/busCfg2.xml

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

         <bean id="logInbound" class="pl.test.TestInInterceptor"/>
         <bean id="logOutbound" class="pl.test.TestOutInterceptor"/>

         <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
             <property name="inInterceptors">
                 <list>
                     <ref bean="logInbound"/>
                 </list>
             </property>
             <property name="outInterceptors">
                 <list>
                     <ref bean="logOutbound"/>
                 </list>
             </property>
             <property name="outFaultInterceptors">
                 <list>
                     <ref bean="logOutbound"/>
                 </list>
             </property>
             <property name="inFaultInterceptors">
                 <list>
                     <ref bean="logInbound"/>
                 </list>
             </property>
         </bean>
    </beans>




Interceptor class pl.test.TestInInterceptor.java (jar with that class 
was copied into {servicemix_home}/lib):

    public class TestInInterceptor extends
    AbstractPhaseInterceptor<Message> {

         public TestInInterceptor() {
             super(Phase.RECEIVE);
             System.out.println("*interceptor created");
         }

         public void handleMessage(Message message) throws Fault {


             final Thread current = Thread.currentThread();
             System.out.println("Consumer inInter  " + current.getId() +
    " " + current.getName() );

         }
    }



In servicmix logs I can't see any information about creating the 
instance of TestInInterceptor and of course interceptor doesn't work...
There is probably something wrong with my configuration, I suppose the 
servicemix doesn't read my busCfg.xml file but I don't know why...


regards

rafal





On 08.10.2012 07:05, Freeman Fang wrote:
> Hi,
>
> You just need add
> busCfg=busCfg.xml
> in conf/servicemix-cxf-bc.cfg
>
> you shouldn't add
>   <import resource="classpath:busCfg.xml"/>
> in servicemix.xml
>
> -------------
> Freeman Fang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web:http://fusesource.com  |http://www.redhat.com/
> Twitter: freemanfang
> Blog:http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo:http://weibo.com/u/1473905042
>
> On 2012-10-5, at 下午7:00, Rafal Janik wrote:
>
>> Hi Freeman,
>>
>> probably I'm still doing something wrong or don't understand it correctly...
>>
>> I've created the busCfg.xml file in conf folder:
>>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>         xmlns:http="http://cxf.apache.org/transports/http/configuration"
>>         xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
>>         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
>>
>>
>>      <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>>      <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>>
>>      <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
>>          <property name="inInterceptors">
>>              <list>
>>                  <ref bean="logInbound"/>
>>              </list>
>>          </property>
>>          <property name="outInterceptors">
>>              <list>
>>                  <ref bean="logOutbound"/>
>>              </list>
>>          </property>
>>          <property name="outFaultInterceptors">
>>              <list>
>>                  <ref bean="logOutbound"/>
>>              </list>
>>          </property>
>>          <property name="inFaultInterceptors">
>>              <list>
>>                  <ref bean="logInbound"/>
>>              </list>
>>          </property>
>>      </bean>
>> </beans>
>>
>> then in servicemix.xml I've added:
>>
>>      <import resource="classpath:busCfg.xml"/>
>>
>> and added into lib folder (without those I were getting classNotFoundException):
>>
>> xmlschema-core-2.0.1.jar
>> neethi-3.0.0.jar
>> cxf-api-2.4.4.jar
>> cxf-common-utilities-2.4.4.jar
>> cxf-rt-core-2.4.4.jar
>>
>>
>> And here I'm not sure if it is right and what should I add to servicemix-cxf-bc.cfg file.
>> And what to do to start/register my cxfbusimpl for modules...
>>
>> (servicemix 3.4.0)
>>
>> regards
>>
>>
>> rafal
>>
>>
>>
>> On 26.09.2012 15:00, Freeman Fang wrote:
>>> Hi,
>>>
>>> Yeah, you need add those files(servicemix-cxf-bc.cfg and cxf bus cfg) yourself.
>>> -------------
>>> Freeman Fang
>>>
>>> Red Hat, Inc.
>>> FuseSource is now part of Red Hat
>>> Web:http://fusesource.com  |http://www.redhat.com/
>>> Twitter: freemanfang
>>> Blog:http://freemanfang.blogspot.com
>>> http://blog.sina.com.cn/u/1473905042
>>> weibo:http://weibo.com/u/1473905042
>>>
>>> On 2012-9-26, at 下午5:42, Rafal Janik wrote:
>>>
>>>> Hi Freeman,
>>>>
>>>> thanks a lot, but I can't see that file in conf dir (servicemix 3.4.0).
>>>> Does it mean I have to create a new one and configure it with the bean:
>>>>
>>>> <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl" />
>>>>
>>>>
>>>>
>>>> regards
>>>>
>>>> rafal
>>>>
>>>> On 26.09.2012 03:39, Freeman Fang wrote:
>>>>> Hi,
>>>>>
>>>>> Yeah, you can configure a bus across component level.
>>>>> Just edit servicemix-cxf-bc.cfg in $SMX_HOME/conf folder, add busCfg property for servicemix-cxf-bc.cfg which point to a cxf bus file where you can add interceptors for this bus and this bus could get picked up by component level.
>>>>>
>>>>> Freeman
>>>>>
>>>>> -------------
>>>>> Freeman Fang
>>>>>
>>>>> Red Hat, Inc.
>>>>> FuseSource is now part of Red Hat
>>>>> Web:http://fusesource.com  |http://www.redhat.com/
>>>>> Twitter: freemanfang
>>>>> Blog:http://freemanfang.blogspot.com
>>>>> http://blog.sina.com.cn/u/1473905042
>>>>> weibo:http://weibo.com/u/1473905042
>>>>>
>>>>> On 2012-9-26, at 上午1:39, Rafal Janik wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> is it possible to add one interceptor for all cxf calls in servicemix 3?
>>>>>>
>>>>>> regards
>>>>>>
>>>>>> rafal
>> -- 
>> <bbbbghhh.gif>
>>
>> <fiiegihe.gif>
>> Rafal Janik
>> Software Engineer
>>   
>>
>> Mobile: +48­ 668­ 483­ 613
>> Phone: +48 12­ 252­ 34­ 00
>> Fax: +48­ 12­ 252­ 34­ 01
>> rafal.janik@softwaremind.pl
>> Software Mind SA
>> ul. Bociana 22A
>> 31-231 Krakow, Poland
>> www.softwaremind.com
>> <aefejdeb.gif>
>> Software Mind SA based in Krakow at ul. Bociana 22A, 31-231 Krakow NIP 9452012822, seed capital PLN 500,000.00 (fully paid up), KRS 0000300409, District Court Kraków Śródmieście, XI Economics Department of the National Court Register
>> The following message is confidential. The full content of the stipulation is avaliable under this link.