You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by contactreji <co...@gmail.com> on 2017/06/01 10:46:04 UTC

Camel http4 // OperationTimeout

Hi guys

Am trying to download some XML data from a url
https://stage-api.organization.com/v2/location?key=dummykey45y374iyti3y4ti7y43y

I am able to download this via browser but not via camel code.

I checked with my API team and I have following inputs 
"*If you are hitting GetAllLocations, the call is a 302 redirect to an HTTPS
download site that downloads the file.  You will need to configure your
Camel client to allow redirects and may need to install the cert for the
download URL (Rackspace) to allow the download to work.*"

Can anyone suggest how to do this in camel ?

Regards
Reji Mathews



-----
Reji Mathews
Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & Jboss Fuse ESB | Mule ESB )
LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
Twitter - reji_mathews
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-http4-OperationTimeout-tp5801630.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel http4 // OperationTimeout

Posted by contactreji <co...@gmail.com>.
Looks like this option is for a different purpose. not really redirection.
Its for Overrideing the Exchange.HTTP_URI and use the url which is
configured in the camel http endpoint.



-----
Reji Mathews
Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & Jboss Fuse ESB | Mule ESB )
LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
Twitter - reji_mathews
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-http4-OperationTimeout-tp5801630p5801657.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel http4 // OperationTimeout

Posted by contactreji <co...@gmail.com>.
I even tried a processor like this using HttpClient API. Still i couldn't
make it work.

*public class Http4Client implements Processor{
    private static String downloadApiData(String url) throws Exception {
        HttpClient client = HttpClientBuilder.create().build();
        HttpGet httpGet = new HttpGet(url);
        httpGet.setHeader("User-Agent", USER_AGENT);
        httpGet.setHeader("Accept",
               
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
        httpGet.setHeader("Accept-Language", "en-US,en;q=0.5");
        HttpResponse response = client.execute(httpGet);


        System.out.println("Got response ->"+response.toString());
        BufferedReader rd = new BufferedReader(
                new InputStreamReader(response.getEntity().getContent()));
        StringBuffer result = new StringBuffer();
        String line = "";
        while ((line = rd.readLine()) != null) {
            result.append(line);
            System.out.println(line);
        }
        return result.toString();
    }

    @Override
    public void process(Exchange exchange) throws Exception {
       
exchange.getIn().setBody(downloadApiData(exchange.getProperty("apiUrl").toString()));
    }
}
*



-----
Reji Mathews
Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & Jboss Fuse ESB | Mule ESB )
LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
Twitter - reji_mathews
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-http4-OperationTimeout-tp5801630p5801631.html
Sent from the Camel - Users mailing list archive at Nabble.com.