0

This one should be trivial but somehow it is not working for me. I am trying to make a call to a RESTLET server hosted on Camel. I get it working with Camel client but I am trying to get the same to work with a bare Apache HTTP Client. The Camel is client is as follows:

   CamelContext context = new DefaultCamelContext();
   Map<String, Object> headers = new HashMap<String, Object>();
   context.createProducerTemplate().requestBodyAndHeaders("restlet:http://localhost:8086/Bookmarkee/boolean/V2?restletMethod=post", "Halleluia",headers);

The HTTP Client I am trying to make work is this:

        HttpPost httppost = new HttpPost("http://localhost:8086/Bookmarkee/boolean/V2?restletMethod=post");
        StringEntity e= new StringEntity("Halleluia",ContentType.create("text/plain", "UTF-8"));
        httppost.setEntity(e);
        CloseableHttpResponse response = httpclient.execute(httppost);

On the server however, the response is not read from the stream by the servlet engine. Resulting in my component being passed an input stream instead of a string.

Any clue?

Klaus
  • 2,328
  • 5
  • 41
  • 62

1 Answers1

0

Experienced same problem when my camel route tried to process empty response from server (200 OK, Content-Length:0, Content-Type:application/json) Fixed after I found and fixed bug in URL which I used for requesting with http component

victor k
  • 23
  • 4