camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem jiang <>
Subject Re: Login/session token with Camel/CXF
Date Tue, 05 Mar 2013 02:53:09 GMT
FYI, I just updated the code of to avoid the NPE issue

Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: |
Blog: ( (English)
 ( (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem

On Tuesday, March 5, 2013 at 2:11 AM, kingolego wrote:

> sothach wrote
> > I need to integrate with a third party system via its WS interface. To
> > send a request, I must first "login" to the server, and obtain an
> > authentication token to attach to all subsequent requests. This token has
> > a limited shelf-life, and will time-out after a period of time, requiring
> > me to re-apply.
> > My question: is there a standard pattern in Camel for this scenario?  
> > My first thought is to implement this by having an enrichment stage, that
> > calls out to "direct:login" route, setting a header with the token, that
> > can then be used when marshaling the call.  
> > Is there a simpler way?
> I am new to camel, but am facing the same problem and have chosen to use the
> enrichment pattern, mostly because I need to implement other, more
> "classical" enrichment scenarios. Interceptors are an alternative approach,
> but I think are not simpler, especially given the timeout and refresh
> requirements.
> Two "bits" of information that may be helpful to you.  
> The Enrich(er) resource is expected to implement the Producer interface.
> This may be obvious to an experienced Cameler, but I didn't see it
> documented and only discovered reading the Enricher source.
> <>
> The Enricher only exercises the process method of the Processor
> super-interface, however, not Service start and stop, at least in my
> configuration. I use a ProducerTemplate instance within the Producer
> implementation that is configured with the same endpoint as the regular
> messages.
> This will not apply to you unless you use CXF messages in Pojo data format
> and "out-of-band" SOAP headers to send the authentication token, but the
> example code in  
> <>  
> is broken. If there are no existing headers, the example
> InsertResponseOutHeaderProcessor.process will throw a NullPointerException,
> mistakenly trying to use the QName from an existing header to create the new
> one.
> I've been meaning to post an issue about this, but there it is....
> Otherwise, the Enrich is working well for me inside a basic proxy based on
> the camel examples, with routing based on the SOAP action/operation.
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at (

View raw message