Search code examples
csvsoaptalend

In Talend, how do you keep input values provided to tSoap so that you can use them with the Soap response?


I have a Talend Job that currently does the following:

Input CSV --Main--> tMap --Output--> tSoap --Main--> Output CSV

The input CSV has ID and TYPE as input columns.

The Map creates a Soap XML (String) message using the ID from the CSV and passes that String to the tSoap component.

The tSoap component fires the web request, which sends the response to the next component. That data is then written to CSV.

The problem is that TYPE from the input CSV is not passed through to amalgamate with the SOAP response data. Only the response data seems accessible.

I've had a look at tBufferInput / tBufferOutput and tFlowToIterate but they seem to work in scenarios where the tSoap component does not depend on an input from the main flow.

Does anyone know which components can be used to achieve the amalgamation?

Thank you


Solution

  • I solved this in the end by:

    1. Placing between the output from the tMap and the input to the tSoap, a new component - tSetGlobalVar

    2. Inside tSetGlobalVar, you can then create a new row, which maps an input column (Value) to a named variable that you specify as the 'Key'. E.g. Key = "ID", Value = row11.ID

    3. The output from tSetGlobalVar then goes into the tSoap component.

    4. The output from tSoap goes into a new tMap.

    5. Inside this new tMap is the Body column from the previous tSoap component which maps to an output column. To access the stored "ID" variable for the current flow/iteration, I created a new output column, and instead of mapping any columns from the inputs, used (String)globalMap.get("ID"); which would insert the value back into the flow.