I am porting a php snippet that relies on cookiejar provided by curl to get cookie and use it in the subsequent calls. I am facing problem with implementing the same code in Java with Apache Camel. I am not able to read the cookie that is returned. Any suggestions?
The php snippet is below:
$ckfile = tempnam ("/tmp", "CURLCOOKIE");
....
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
// Executing the ch
$result['EXE'] = curl_exec($ch);
$result['INF'] = curl_getinfo($ch);
$result['ERR'] = curl_error($ch);
//print_r($result['EXE']);
Its a bit poor description of the problem you do. With only the PHP code. And no information about which Camel version, and what you do in Camel etc.
For what it is worth, the cookies ought to be stored as headers in the Camel message.