[resolved] Using SOAP response on a second output from the same tXMLMap

One Star

[resolved] Using SOAP response on a second output from the same tXMLMap

Hello,
Can I use the response from a soap request as a value in a second output in the same tXMLMap?

Accepted Solutions
Community Manager

Re: [resolved] Using SOAP response on a second output from the same tXMLMap

Hi
Extract the value of AddSResult element from the response of tSOAP_2 and store it to a global variable for used later, store the document of UpdateFieldMoarada output to a global variable. The job looks like:
tSOAP_1--main--tXMLMap_1---main--tSOAP_2--main--tExtractXMLField_1--main--tJavaRow_1
-- UpdateFieldMoarada-->tJavaRow_2
|
onsubjobok
|
tFixedFlowInput_1--main--tXMLMap_2--main-->tSOAP_3
on tJavaRow_1: store the value of AddSResult element to global varaible, for example:
globalMap.get("processKey", input_row.AddSResult);
on tJavaRow_1: document of UpdateFieldMoarada output to a global variable, for example:
globalMap.get("UpdateFieldMoarada ", input_row.Soap);
on tFixedFlowInput_1: generate the UpdateFieldMoarada document and pass it to tXMLMap_2.
on tXMLMap_2, you can get the processKey with expression:
(Integer)globalMap.get("processKey")
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

Re: [resolved] Using SOAP response on a second output from the same tXMLMap

Hi
A screenshot of job design you are working will be helpful for us to understand your request.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Using SOAP response on a second output from the same tXMLMap

Ok Shong, here goes:
I'm querying a sharepoint list based on infopath forms submitted by users on one side, and opening support tickets on the other.
For each item in SP, I'm opening a ticket and getting in response a "processKey" (tSoap2)
Next I need to update additional fields with user information: Name, Address, phone... For this I need the "processKey" value to associate each of these additional fields with the correct ticket. I created a second output in tXMLMap_1 and hoped to get "processKey" tSoap_2, but cannot find a way to make it work. Tried globalVars, context, tFlowtoInterate...
Any help would be appreciated. Thanks
One Star

Re: [resolved] Using SOAP response on a second output from the same tXMLMap

Response from tSoap_2 is:
<root>
<row>
<Soap><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><AddSResponse xmlns="http://www.link.pt/e-doclink/webservices"><AddSResult>32527</AddSResult></AddSResponse></soap:Body></soap:Envelope></Soap>
</row>
<row>
<Soap><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><AddSResponse xmlns="http://www.link.pt/e-doclink/webservices"><AddSResult>32528</AddSResult></AddSResponse></soap:Body></soap:Envelope></Soap>
</row>
...
AddSResult has the processKey I need for tSoap_3
One Star

Re: [resolved] Using SOAP response on a second output from the same tXMLMap

output result from schema below is:

42637
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><updateField xmlns="http://www.link.pt/e-doclink/webservices"><processKey/><field>35</field><fieldValue>cx-103 Cabo Vilar do Monte</fieldValue></updateField></soap:Body></soap:Envelope>
42638
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><updateField xmlns="http://www.link.pt/e-doclink/webservices"><processKey/><field>35</field><fieldValue>E. N. 378, nº 34</fieldValue></updateField></soap:Body></soap:Envelope>
42639
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><updateField xmlns="http://www.link.pt/e-doclink/webservices"><processKey/><field>35</field><fieldValue>RUA ANTONIO ALVARES SANTOS JUNIOR, Nº50 R/C</fieldValue></updateField></soap:Body></soap:Envelope>
....
Community Manager

Re: [resolved] Using SOAP response on a second output from the same tXMLMap

Hi
Extract the value of AddSResult element from the response of tSOAP_2 and store it to a global variable for used later, store the document of UpdateFieldMoarada output to a global variable. The job looks like:
tSOAP_1--main--tXMLMap_1---main--tSOAP_2--main--tExtractXMLField_1--main--tJavaRow_1
-- UpdateFieldMoarada-->tJavaRow_2
|
onsubjobok
|
tFixedFlowInput_1--main--tXMLMap_2--main-->tSOAP_3
on tJavaRow_1: store the value of AddSResult element to global varaible, for example:
globalMap.get("processKey", input_row.AddSResult);
on tJavaRow_1: document of UpdateFieldMoarada output to a global variable, for example:
globalMap.get("UpdateFieldMoarada ", input_row.Soap);
on tFixedFlowInput_1: generate the UpdateFieldMoarada document and pass it to tXMLMap_2.
on tXMLMap_2, you can get the processKey with expression:
(Integer)globalMap.get("processKey")
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Using SOAP response on a second output from the same tXMLMap

Thanks Shong!
I can rule the world now!