You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Chris Hardin <ch...@gmail.com> on 2010/06/02 17:08:14 UTC

Help! My interceptors fire for client calls

I have the config below. I have a huge problem though. The interceptors are
not only firing when someone calls my services, they also fire when I call
another service. I only want these interceptors to fire for the services
that I have exposed and not the ones I call out to another ESB for.

 <cxf:bus>

    <cxf:inInterceptors>
           <ref bean="timerIn"/>
            <ref bean="openSessionIn"/>
        </cxf:inInterceptors>
        <cxf:outInterceptors>

            <ref bean="openSessionOut"/>
              <ref bean="timerOut"/>
       </cxf:outInterceptors>

        <cxf:features>
             <cxf:logging />
           <cxf:fastinfoset/>
<!--           <ref bean="gzipFeature"/>-->

        </cxf:features>

        <cxf:properties>

          <entry key="schema-validation-enabled" value="false" />
        </cxf:properties>

    </cxf:bus>

Re: Help! My interceptors fire for client calls

Posted by Chris Hardin <ch...@gmail.com>.
Daniel,

Option 3 worked like charm. Thanks.. You are the man!

Chris


On Wed, Jun 2, 2010 at 11:51 AM, Daniel Kulp <dk...@apache.org> wrote:

>
> Could options:
>
> 1) You could use a separate bus for the client calls.  In your code, you
> would
> do something like :
>
> BusFactory.setDefaultBus(null);  BusFactory.setThreadDefaultBus(null);
>
> before creating the client.  That should force the creation of a new bus
> for
> the client with defaults.
>
> 2) Configure your interceptors  on the jaxws:endpoint things instead of the
> bus.   Just stick them on the endpoints where they are needed.
>
> 3) Modify the interceptors to check if it's a requestor and pretty much
> skip
> whatever they are doing.     Just add:
>
> if (MessageUtils.isRequestor(message)) {
>    return;
> }
>
> to the handleMessage calls.
>
>
> Dan
>
>
>
>
> On Wednesday 02 June 2010 11:08:14 am Chris Hardin wrote:
> > I have the config below. I have a huge problem though. The interceptors
> are
> > not only firing when someone calls my services, they also fire when I
> call
> > another service. I only want these interceptors to fire for the services
> > that I have exposed and not the ones I call out to another ESB for.
> >
> >  <cxf:bus>
> >
> >     <cxf:inInterceptors>
> >            <ref bean="timerIn"/>
> >             <ref bean="openSessionIn"/>
> >         </cxf:inInterceptors>
> >         <cxf:outInterceptors>
> >
> >             <ref bean="openSessionOut"/>
> >               <ref bean="timerOut"/>
> >        </cxf:outInterceptors>
> >
> >         <cxf:features>
> >              <cxf:logging />
> >            <cxf:fastinfoset/>
> > <!--           <ref bean="gzipFeature"/>-->
> >
> >         </cxf:features>
> >
> >         <cxf:properties>
> >
> >           <entry key="schema-validation-enabled" value="false" />
> >         </cxf:properties>
> >
> >     </cxf:bus>
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>

Re: Help! My interceptors fire for client calls

Posted by Daniel Kulp <dk...@apache.org>.
Could options:

1) You could use a separate bus for the client calls.  In your code, you would 
do something like :

BusFactory.setDefaultBus(null);  BusFactory.setThreadDefaultBus(null);

before creating the client.  That should force the creation of a new bus for 
the client with defaults.

2) Configure your interceptors  on the jaxws:endpoint things instead of the 
bus.   Just stick them on the endpoints where they are needed.    

3) Modify the interceptors to check if it's a requestor and pretty much skip 
whatever they are doing.     Just add:

if (MessageUtils.isRequestor(message)) {
    return;
}

to the handleMessage calls. 


Dan




On Wednesday 02 June 2010 11:08:14 am Chris Hardin wrote:
> I have the config below. I have a huge problem though. The interceptors are
> not only firing when someone calls my services, they also fire when I call
> another service. I only want these interceptors to fire for the services
> that I have exposed and not the ones I call out to another ESB for.
> 
>  <cxf:bus>
> 
>     <cxf:inInterceptors>
>            <ref bean="timerIn"/>
>             <ref bean="openSessionIn"/>
>         </cxf:inInterceptors>
>         <cxf:outInterceptors>
> 
>             <ref bean="openSessionOut"/>
>               <ref bean="timerOut"/>
>        </cxf:outInterceptors>
> 
>         <cxf:features>
>              <cxf:logging />
>            <cxf:fastinfoset/>
> <!--           <ref bean="gzipFeature"/>-->
> 
>         </cxf:features>
> 
>         <cxf:properties>
> 
>           <entry key="schema-validation-enabled" value="false" />
>         </cxf:properties>
> 
>     </cxf:bus>

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: Help! My interceptors fire for client calls

Posted by Glen Mazza <gl...@gmail.com>.
I'm not sure how to do that, but you can also attach interceptors to specific
web service providers instead of at the bus-level, so the interceptors would
not be called except for incoming calls to those particular services.  That
might work for you.

Glen


Chris Hardin wrote:
> 
> How would that work? How could I configure to separate the client and
> server
> calls??
> 
> On Wed, Jun 2, 2010 at 10:25 AM, Benson Margulies
> <bi...@gmail.com>wrote:
> 
>> I think that you will need to set up two busses.
>>
>> On Wed, Jun 2, 2010 at 11:08 AM, Chris Hardin <ch...@gmail.com>
>> wrote:
>> > I have the config below. I have a huge problem though. The interceptors
>> are
>> > not only firing when someone calls my services, they also fire when I
>> call
>> > another service. I only want these interceptors to fire for the
>> services
>> > that I have exposed and not the ones I call out to another ESB for.
>> >
>> >  <cxf:bus>
>> >
>> >    <cxf:inInterceptors>
>> >           <ref bean="timerIn"/>
>> >            <ref bean="openSessionIn"/>
>> >        </cxf:inInterceptors>
>> >        <cxf:outInterceptors>
>> >
>> >            <ref bean="openSessionOut"/>
>> >              <ref bean="timerOut"/>
>> >       </cxf:outInterceptors>
>> >
>> >        <cxf:features>
>> >             <cxf:logging />
>> >           <cxf:fastinfoset/>
>> > <!--           <ref bean="gzipFeature"/>-->
>> >
>> >        </cxf:features>
>> >
>> >        <cxf:properties>
>> >
>> >          <entry key="schema-validation-enabled" value="false" />
>> >        </cxf:properties>
>> >
>> >    </cxf:bus>
>> >
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Help%21-My-interceptors-fire-for-client-calls-tp28755929p28756966.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Help! My interceptors fire for client calls

Posted by Chris Hardin <ch...@gmail.com>.
How would that work? How could I configure to separate the client and server
calls??

On Wed, Jun 2, 2010 at 10:25 AM, Benson Margulies <bi...@gmail.com>wrote:

> I think that you will need to set up two busses.
>
> On Wed, Jun 2, 2010 at 11:08 AM, Chris Hardin <ch...@gmail.com>
> wrote:
> > I have the config below. I have a huge problem though. The interceptors
> are
> > not only firing when someone calls my services, they also fire when I
> call
> > another service. I only want these interceptors to fire for the services
> > that I have exposed and not the ones I call out to another ESB for.
> >
> >  <cxf:bus>
> >
> >    <cxf:inInterceptors>
> >           <ref bean="timerIn"/>
> >            <ref bean="openSessionIn"/>
> >        </cxf:inInterceptors>
> >        <cxf:outInterceptors>
> >
> >            <ref bean="openSessionOut"/>
> >              <ref bean="timerOut"/>
> >       </cxf:outInterceptors>
> >
> >        <cxf:features>
> >             <cxf:logging />
> >           <cxf:fastinfoset/>
> > <!--           <ref bean="gzipFeature"/>-->
> >
> >        </cxf:features>
> >
> >        <cxf:properties>
> >
> >          <entry key="schema-validation-enabled" value="false" />
> >        </cxf:properties>
> >
> >    </cxf:bus>
> >
>

Re: Help! My interceptors fire for client calls

Posted by Benson Margulies <bi...@gmail.com>.
I think that you will need to set up two busses.

On Wed, Jun 2, 2010 at 11:08 AM, Chris Hardin <ch...@gmail.com> wrote:
> I have the config below. I have a huge problem though. The interceptors are
> not only firing when someone calls my services, they also fire when I call
> another service. I only want these interceptors to fire for the services
> that I have exposed and not the ones I call out to another ESB for.
>
>  <cxf:bus>
>
>    <cxf:inInterceptors>
>           <ref bean="timerIn"/>
>            <ref bean="openSessionIn"/>
>        </cxf:inInterceptors>
>        <cxf:outInterceptors>
>
>            <ref bean="openSessionOut"/>
>              <ref bean="timerOut"/>
>       </cxf:outInterceptors>
>
>        <cxf:features>
>             <cxf:logging />
>           <cxf:fastinfoset/>
> <!--           <ref bean="gzipFeature"/>-->
>
>        </cxf:features>
>
>        <cxf:properties>
>
>          <entry key="schema-validation-enabled" value="false" />
>        </cxf:properties>
>
>    </cxf:bus>
>