Hi all,

I´m working with the Camel LDAP component. As we can read in the 
http://camel.apache.org/ldap.html LDAP page  "The result is returned in the
Out body". 
I´ve seen in the code of LdapProducer.java (process method), that we only
have this line related to the Out message:
exchange.getOut().setBody(data);

The *problem* here is that, only using this code line, we lose the IN
headers and I need to keep them.

I´ve tried to copy the In headers in the Out headers before calling the LDAP
endpoint using: a processor, the properties exchange, ... but LDAP always
gets this error:
javax.naming.directory.InvalidSearchFilterException: Empty filter; remaining
name 'ou=system'
    at com.sun.jndi.ldap.Filter.encodeFilterString(Filter.java:37)
    at com.sun.jndi.ldap.LdapClient.search(LdapClient.java:519)
    at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1965)
    at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1827)
    at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1752)
    at
com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:368)
    at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:338)
    at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:321)
    at
javax.naming.directory.InitialDirContext.search(InitialDirContext.java:248)
    at
org.apache.camel.component.ldap.LdapProducer.simpleSearch(LdapProducer.java:99)
    at
org.apache.camel.component.ldap.LdapProducer.process(LdapProducer.java:72)
    at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
    at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115)
    at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285)
    at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)
    at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
    at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
 

I only need to add a dummy outHeader to get this LDAP error.

In the end, *the solution* i´ve used to solve this problem is extending the
LDAP component:
   <bean id="ldap" class="xxx.ExtendedLdapComponent" />

and i´ve added only this line before calling to the process method in the
LdapProducer,
   exchange.getOut().setHeaders(exchange.getIn().getHeaders());

I don´t like this solution but it´s the only one i´ve found to solve it. 

Is this a bug in the LDAP Component or the idea of not keeping the headers
is correct?

Thanks
Kind Regards,

Ana Cortés.





--
View this message in context: 
http://camel.465427.n5.nabble.com/LDAP-Component-lose-headers-tp5696602.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to