You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jhonny <wr...@live.com> on 2013/10/15 14:39:07 UTC

How to provide basic authoraizaton (user & password) in Spring DSL to acess rest webservice

Hi All,

I want to hit the rest url (http request GET) to get the data. so in my
SPRING DSL file i had put the url as below in "from" tag.

   <from
uri="http4://mydata.services.se/data/api/1?user=admin&amp;password=adminpass"
/>

Am using campel-http4 component for this. But in my appllication am getting
the error response as below

"HTTP Status 401 - Full authentication is required to access this resource"


[/I had tried the above url in browser and it work/ ]

Can somebody help me ?, how should i put the authorization in my above URL
in my spring DSL file ?






--
View this message in context: http://camel.465427.n5.nabble.com/How-to-provide-basic-authoraizaton-user-password-in-Spring-DSL-to-acess-rest-webservice-tp5741597.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: How to provide basic authoraizaton (user & password) in Spring DSL to acess rest webservice

Posted by siddharthrajjain <si...@yahoo.com>.
you can try :
 <bean id="httpAuth"
class="org.apache.camel.component.http.HttpConfiguration">
        <property name="authMethod" value="Basic"/>
        <property name="authUsername" value="username"/>
        <property name="authPassword" value="password"/>
   </bean>


   <bean id="http" class="org.apache.camel.component.http.HttpComponent">
        <property name="camelContext" ref="yourcontext"/>
        <property name="httpConfiguration" ref="httpAuth"/>
   </bean>



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-provide-basic-authoraizaton-user-password-in-Spring-DSL-to-acess-rest-webservice-tp5741597p5741776.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: How to provide basic authoraizaton (user & password) in Spring DSL to acess rest webservice

Posted by jhonny <wr...@live.com>.
Hi,

Thanks for the input.

Basically am looking for the tag which should required to write in my spring XML (spring DSL) to set header with basic authorisation parameter such user and password.

________________________________
From: Mark Frazier [via Camel]<ma...@n5.nabble.com>
Sent: ‎15-‎10-‎2013 21:37
To: jhonny<ma...@live.com>
Subject: Re: How to provide basic authoraizaton (user & password) in Spring DSL to acess rest webservice



I was getting that error when using the http component, even though creds were correct.

When you call http, it will convert ALL exchange headers and send them along to the component. The extra headers caused a length mismatch with what was set for the http call. Once I
put on a filter to remove headers that weren't necessary for the http call, it worked fine.

Still still may be a authentication problem for you, just be aware the response codes aren't always accurate. ;-)

On Oct 15, 2013, at 5:39 AM, jhonny <wr...@live.com> wrote:

> Hi All,
>
> I want to hit the rest url (http request GET) to get the data. so in my
> SPRING DSL file i had put the url as below in "from" tag.
>
>   <from
> uri="http4://mydata.services.se/data/api/1?user=admin&amp;password=adminpass"
> />
>
> Am using campel-http4 component for this. But in my appllication am getting
> the error response as below
>
> "HTTP Status 401 - Full authentication is required to access this resource"
>
>
> [/I had tried the above url in browser and it work/ ]
>
> Can somebody help me ?, how should i put the authorization in my above URL
> in my spring DSL file ?
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-provide-basic-authoraizaton-user-password-in-Spring-DSL-to-acess-rest-webservice-tp5741597.html
> Sent from the Camel - Users mailing list archive at Nabble.com.





_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/How-to-provide-basic-authoraizaton-user-password-in-Spring-DSL-to-acess-rest-webservice-tp5741597p5741611.html

To unsubscribe from How to provide basic authoraizaton (user & password) in Spring DSL to acess rest webservice, visit http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5741597&code=d3JpdGVkZXNobXVraEBsaXZlLmNvbXw1NzQxNTk3fDE2MDkzNTgyOTU=




--
View this message in context: http://camel.465427.n5.nabble.com/How-to-provide-basic-authoraizaton-user-password-in-Spring-DSL-to-acess-rest-webservice-tp5741597p5741692.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to provide basic authoraizaton (user & password) in Spring DSL to acess rest webservice

Posted by Mark Frazier <mm...@icloud.com>.
I was getting that error when using the http component, even though creds were correct.

When you call http, it will convert ALL exchange headers and send them along to the component. The extra headers caused a length mismatch with what was set for the http call. Once I 
put on a filter to remove headers that weren't necessary for the http call, it worked fine.

Still still may be a authentication problem for you, just be aware the response codes aren't always accurate. ;-)

On Oct 15, 2013, at 5:39 AM, jhonny <wr...@live.com> wrote:

> Hi All,
> 
> I want to hit the rest url (http request GET) to get the data. so in my
> SPRING DSL file i had put the url as below in "from" tag.
> 
>   <from
> uri="http4://mydata.services.se/data/api/1?user=admin&amp;password=adminpass"
> />
> 
> Am using campel-http4 component for this. But in my appllication am getting
> the error response as below
> 
> "HTTP Status 401 - Full authentication is required to access this resource"
> 
> 
> [/I had tried the above url in browser and it work/ ]
> 
> Can somebody help me ?, how should i put the authorization in my above URL
> in my spring DSL file ?
> 
> 
> 
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-provide-basic-authoraizaton-user-password-in-Spring-DSL-to-acess-rest-webservice-tp5741597.html
> Sent from the Camel - Users mailing list archive at Nabble.com.