In a ESB route I'm using cHttp POST to connect to a https server. Then my 2nd request is to post data to that server. I added the certificate in my JVM , it works in a tool like Postman or Insomnia but not in my route because I guess the session cookie we get after the first call is not included in the 2nd one, than I get a 401 forbidden error.
What is the solution to keep cookie from first to second https requests ?
Could you please try to call a DI job as shown in below scenario?
A sample scenario about handling cookies can be referred from below link.
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved
We don't want to use jobs. We work with route, and Talend itself says calling a job via cJob is not a good solution because of performance issues.
I tried this code just at the moment ans it works (send back the "Set-Cookie" camel header as "cookie", substring to remove the brackets)
String cookieString = exchange.getIn().getHeader("Set-Cookie", String.class); exchange.getIn().setHeader("Cookie", cookieString.substring(1, cookieString.length()-2) );
But I wonder if there is any built-in and more robust solution. I believe the route itself should automatically manage cookies by default , as Camel does.
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Learn how to use an API-First Approach to Modernize your Applications
Take a look at this technical overview video of Talend API Designer
Find out how to get started with APIs