Grokbase Groups Camel users May 2015
FAQ
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.

Search Discussions

  • Claus Ibsen at May 27, 2015 at 12:46 pm
    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 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/
  • Erd at May 27, 2015 at 6:43 pm
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedMay 26, '15 at 5:31p
activeMay 27, '15 at 6:43p
posts3
users2
websitecamel.apache.org

2 users in discussion

Erd: 2 posts Claus Ibsen: 1 post

People

Translate

site design / logo © 2021 Grokbase