You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by erd <ev...@gmail.com> on 2015/05/26 19:31:10 UTC

Handling header-less responses

Hello all,
I have a route which GETs JSON from an external HTTP service. Some of the
servers do not respond with any headers, resulting in
httpclient.clientProtocolException. what is the best way to have the route
assume a response header like the following?

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 13
Connection: close

Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Handling-header-less-responses-tp5767502.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Handling header-less responses

Posted by erd <ev...@gmail.com>.
Thanks for the reply. I should add that i'm using spring on camel 2.14 with
the regular http component.

here is the stacktrace, I hit the service with telnet, and it returned no
headers, so I am assuming that is the issue here. Furthermore, the service
that does have headers works fine. the header-less services throw: 

org.apache.commons.httpclient.ProtocolException: The server 192.168.x.xx
failed to respond with a valid HTTP response
	at
org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1987)
	at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
	at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
	at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
	at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
	at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
	at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
	at
org.apache.camel.component.http.HttpProducer.executeMethod(HttpProducer.java:244)
	at
org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:144)
	at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
	at
org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:165) 



--
View this message in context: http://camel.465427.n5.nabble.com/Handling-header-less-responses-tp5767502p5767567.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Handling header-less responses

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Can you tell more about which http component you use, and what that
exception is? maybe with a stacktrace.

Camel has a bunch of http components so you can always try one of the others.

On Tue, May 26, 2015 at 7:31 PM, erd <ev...@gmail.com> wrote:
> Hello all,
> I have a route which GETs JSON from an external HTTP service. Some of the
> servers do not respond with any headers, resulting in
> httpclient.clientProtocolException. what is the best way to have the route
> assume a response header like the following?
>
> HTTP/1.1 200 OK
> Content-Type: application/json
> Content-Length: 13
> Connection: close
>
> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Handling-header-less-responses-tp5767502.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/