tESBConsumer1 HTTP Headers in globalMap: how to use them in tESBConsumer2?

Two Stars

tESBConsumer1 HTTP Headers in globalMap: how to use them in tESBConsumer2?

Hello,

 

A SOAP Webservice I want to consume with a Talend job requires cookie storage between operations. A first operation using tESBConsumer_1 gets the cookie in the HTTP Headers ("Set-Cookie") of the response. I read in the community discussions that the headers are stored in the globalMap, and I verified that using Java debugging.

 

But how do I use the "tESBConsumer_1_HTTP_HEADERS" variable within the global map as a custom HTTP header in a next ESBConsumer (tESBConsumer_2)?

 

Unfortunately, I lack the Java coding background to write the code for a tJava component. My tJava component currently contains the single line "((java.util.Map<String,java.util.List>)globalMap.get("tESBConsumer_1_HTTP_HEADERS")).get("Set-Cookie").get(1)", which I found in a related topic. But it yields some java errors. 

 

So, (1) What needs to be in my tJava component? (2) How does my tJava component need to be connected to tESBConsumer_1 (3) How do I pass on the "Set-Cookie" value to the custom header of my next tESBConsumer (tESBConsumer_2)?

 

I appreciate your input! 

 

Jesper

 

 

 

Moderator

Re: tESBConsumer1 HTTP Headers in globalMap: how to use them in tESBConsumer2?

Hello,

When you type in tESBConsumer and press STRG+Space for autocomplete , it should be autocompletion to
{code:java}
((java.util.Map<String,java.util.List<String>>)globalMap.get("tESBConsumer_1_HTTP_HEADERS"));{code}

Here is a related topic:https://community.talend.com/t5/Design-and-Development/tSOAP-access-the-response-header/m-p/133677.

Hope it will be helpful.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

An API-First Approach to Modernizing Applications

Learn how to use an API-First Approach to Modernize your Applications

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read