I am having an incredibly difficult time convincing the HTTP endpoint (Camel
version 2.6) to add basic authentication headers to a simple POST request. 
Here's a very simple route: 

         from("direct:routes"). 
        
to("http://localhost/whatever?authMethod=Basic&authUsername=me&authPassword=secret";);
 

And here's how I make the request using a ProducerTemplate: 

        ProducerTemplate template = context.createProducerTemplate(); 
        HashMap headers = new HashMap(); 
        headers.put(Exchange.CONTENT_TYPE, "application/json"); 
        headers.put(Exchange.HTTP_METHOD, "POST"); 
        String payload = "{\"type\": \"data\"}"; 
        String rsp = template.requestBodyAndHeaders("direct:routes",
payload, headers, String.class); 

And here's the TCPDUMP output.  Notice that no authentication headers are
present: 

POST /whatever HTTP/1.1 
User-Agent: Jakarta Commons-HttpClient/3.1 
Host: localhost 
Content-Length: 16 
Content-Type: application/json 

{"type": "data"} 

What do I have to do to get the encoded Basic authorization headers appended
to the request?  Apologies in advance for what will surely be an utterly
obvious solution (to everyone except me).

--
View this message in context: 
http://camel.465427.n5.nabble.com/Basic-HTTP-Authentication-headers-missing-using-HTTP-component-tp3414749p3414749.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to