Hi Thomas,
I see some solutions:
a) configure interceptors only for necessary clients, not on the bus level
b) as you suggested, check endpoints inside the interceptor (you should define
kind of endpoints map in configuration)
c) define specific property for client:
<jaxws:client id="client"
xmlns:serviceNamespace="http://mynamespace"
serviceClass="org.apache.MyClass"
serviceName="serviceNamespace:MyService"
endpointName="serviceNamespace:MySOAP">
<address="http://localhost:8080/services/MyService">
<jaxws:properties>
<entry key="org.mycompany.activate.security"
value="true" />
</jaxws:properties>
</jaxws:client>
And check this property in interceptor, activate functionality only if property
is true.
Regards,
Andrei.
> -----Original Message-----
> From: Thomas Manson [mailto:[email protected]]
> Sent: Freitag, 7. Februar 2014 01:03
> To: [email protected]
> Subject: Re: Per Client interceptor
>
> Hi All,
>
> I don't understand why we talk about server side, for me it's just about
> client
> (and an interceptor in the "out" way)
>
> I've 2 webservices to call (so client side for both) (a set of WSDL
> for application A, and another WSDL for application B, A & B are
> third party application that expose webservices (ie: server side))
>
> I want to add security header for one of them independently of the other
> (only
> for soap request that will hit application A)
>
> One of my idea was to check in my OutInterceptor which endpoint is called to
> see if I have to add security headers or not.
> So my interceptor would just care about my soap call, not other soap call. If
> other soap call need interceptor they would add another one which take care of
> their endpoints. (also piling interceptor may not be the best things for
> performances)
>
> But I thought there would a more simpler way of doing, just by configuration.
> I don't think it's that exotic that Application X call Application A & B with
> different credentials (or other specific stuff).
>
> Regards,
> Thomas.
>
>
>
> On Thu, Feb 6, 2014 at 10:23 PM, Sergey Beryozkin <[email protected]>
> wrote:
> > Hi
> >
> > On 06/02/14 19:17, Daniel Kulp wrote:
> >>
> >>
> >> There are a couple of options:
> >>
> >> 1) In your interceptor itself, detect if it’s client side or server
> >> side and act appropriately. We have a MessageUtils.isRequestor(msg)
> >> method that will return true if we’re on the client (requestor) side.
> >>
> >> 2) Implement a ClientLifecycleListener that would only add the
> >> interceptor at creation. It wouldn’t apply to servers then.
> >>
> >
> > I've been thinking at the introduction of a new @Scope (sub)
> > annotation too, haven't had the time to look more into it, but if
> > introduced it can offer another option,
> >
> > Thanks, Sergey
> >
> >
> >>
> >>
> >> Dan
> >>
> >>
> >>
> >> On Feb 6, 2014, at 8:28 AM, Thomas Manson
> >> <[email protected]>
> >> wrote:
> >>
> >>> Hi,
> >>>
> >>> I've build a library that calls a set of webservices (provided by
> >>> the same application) with CXF.
> >>>
> >>> I've my own interceptor that is attached to the Bus :
> >>>
> >>> <cxf:bus>
> >>> <cxf:features>
> >>> <p:policies />
> >>> <cxf:logging />
> >>> </cxf:features>
> >>> <cxf:outInterceptors>
> >>> <ref bean="AMXBPMSecurityWSS4JOutInterceptor" />
> >>> </cxf:outInterceptors>
> >>> </cxf:bus>
> >>>
> >>> My library is included in a webapplication, that needs to consume
> >>> another webservice (different from the one used by my library).
> >>>
> >>> with my interceptor I trap all outgoing soap call, so it interfere
> >>> with the webapp soap call, and make them fail for security reasons.
> >>>
> >>> How can I configure my interceptor only for a set of clients, so
> >>> that my library is agnostic and do not interfere with other soap call?
> >>>
> >>> All example I've found attach the interceptor to the bus.
> >>>
> >>> Regards,
> >>> Thomas.
> >>
> >>
> >
> >
> > --
> > Sergey Beryozkin
> >
> > Talend Community Coders
> > http://coders.talend.com/
> >
> > Blog: http://sberyozkin.blogspot.com