camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: camel-http: basic authentication and query parameter "username"
Date Tue, 02 Mar 2010 02:16:11 GMT
Hi Matteo,

Did you receive my reply mail and try the solution of setting the 
message header with the Exchange.HTTP_QUERY just like this ?

from("timer://foo?fixedRate=true&delay=0&period=10000")
.setHeader(Exchange.HTTP_QUERY, "username=YOUR_NAME")
.to("http://remoteserver.location/get_user_info.xml?username=matteo&password=matteosPassword")
 
.setHeader(FileComponent.HEADER_FILE_NAME,"get_user_info.xml").to("file:target/google");


Willem


Matteo Redaelli wrote:
> The problem is that I should manage 2 "username" parameters!
> 
> 1)the first is a query parameter add in the remote url: it will be used to
> retreive info about that user 
> 
> 2) but, for basic authentication, camel also requires a parameter with the
> same name "username" ... and the username for the basic authentication is
> always different from the username I need to put in the url query..
> 
> 
> 
> 
> ychawla wrote:
>> Hi Matteo,
>> Did you check out this link:
>>
>> http://camel.apache.org/http.html
>>
>> It has info on connecting using basic auth.  This example show a poll from
>> google that you can adapt to meet your needs.  Below is polls your URL and
>> then write the result to a file:
>>
>> from("timer://foo?fixedRate=true&delay=0&period=10000")
>>    
>> .to("http://remoteserver.location/get_user_info.xml?username=matteo&password=matteosPassword")
>>     .setHeader(FileComponent.HEADER_FILE_NAME,
>> "get_user_info.xml").to("file:target/google");
>>
>> or in Spring
>>
>> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"
>> trace="true">
>>     <route>
>>         <from uri="direct:start"/>
>>         <to
>> uri="http://remoteserver.location/get_user_info.xml?username=matteo&amp;password=matteosPassword"/>
>>         <to uri="mock:result"/>
>>     </route>
>> </camelContext>
>>
>> Cheers,
>> Yogesh
>>
>>
>> Matteo Redaelli wrote:
>>> Hello
>>>
>>> With camel-http I'd like to retreive an xml document from an url like
>>>
>>>  http://remoteserver.location/get_user_info.xml?username=matteo
>>>
>>> BUT that url requires a basic authentication
>>>
>>> where  do I have to set basic auth params (username and password) and
>>> where my query parameter "username"?? I read about adding params in url
>>> or setting up header variable Exchange.HTTP_QUERY ..
>>>
>>> Thanks in advance
>>> Matteo
>>> http://www.redaelli.org
>>>
>>>
>>
> 


Mime
View raw message