Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] How to use SOAP messages to filter Oracle recordset

Hello, I am new to Talend and trying out ESB for one of our new webservice projects. I have a simple requirement to use a SOAP-call embedded attribute to filter our Oracle return recordset. 
Basically, we need the SOAP request from tESBProviderRequest1 to filter tOracleInput or in this testbed, tAcccessInput_1 to return only two records to tESBProviderResponse. I don't know how to extract the “SalesRepId” from tFlowToIterate as a global variable and apply it as a filter or parameter to the database query.
I also tried passing to an tOracleSP transformation to no success. We can't seem to spool multiple records to xml. If anybody has samples of that, would greatly help as well.
Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi 
From the log message, we can confirm that this error is caused by empty row. To resolve it, you have to check if the recordset extract from access DB is empty or not first, and then, trigger different processing based on the check result. For example:
tERequest-main-tXMap-tFl..rate-iterate-tAinput1-tHashOutPut-oncomponentok-tJava-runIf1-tHashInput-tXMap-tEsbProviderRes...
                                                                                                                          -runIf2-tFixedFlowInput-tXMap- tEsbProviderRes

tHashOutput: extract the data from DB and store it in memory.
tjava: check if the recordset is empty or not. 
int nb_line=(Integer)globalMap.get("tAccessInput_1_NB_LINE");
if(nb_line==0){
globalMap.put("isEmpty",true);
}else{
globalMap.put("isEmpty", false);
}

Set the condition of runif1 as:
!(Boolean)globalMap.get("isEmpty")

\\It means if the recordset is not empty, read the data from memory and output them.
Set the condition of runIf2 as:
(Boolean)globalMap.get("isEmpty")

tFixeFlowInput: customize a output message if the recordset is empty, for example, define one column on the schema, and customize the value as:
"No rows return"

Best regards
Shong

View solution in original post

13 Replies
Anonymous
Not applicable
Author

Hi
You need a tXMLMap after tESBProviderRequest to extract the SalesRepId data from the input document, and then you are able to use this data in other components later (use it in tAccessInput_1 as filter condition in your this example), read the tFlowToIterate component manual to learn how to access the data.

Best regards
Shong
Anonymous
Not applicable
Author

Thank you. Somehow this didn't work earlier when I tried it. The tAccessinput schema wouldn't show its schema, just the payload. Now it works after I rebuilt the map (Map 1) per your suggestions and am able to read the global vars. I was also able to make it work via a different map (Map 2) using the Lookup method, but Map 1 is preferred since it will bring less db records to the transformation.
Using Map 1 however doesn't serve up an empty record gracefully. I made the loop esbresponse loop node optional but it gives this when there are no expected records from the filtered recordset.
Can you further advise?
<soap:Envelope xmlns:soap="">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap 0683p000009M9p6.pngerver</faultcode>
         <faultstring>Could not generate the XML stream caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at : .</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>
Anonymous
Not applicable
Author

<faultstring>Could not generate the XML stream caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog

If I understand your problem well, you got this error if there is no records are sent to tESBProviderResponse, if that is the case, you need to create another output table on tXMLMap for tESBProviderFault.
0683p000009MC7v.png 0683p000009MBr0.png
Best regards
Shong
Anonymous
Not applicable
Author

Thank you for your quick response. I did try that tESBProviderFault with my earlier map design using tFlowToIterate and tAccessInput as a second terminal to tESBProviderResponse. It didn't make a difference. My error still came up.
Ironically, my other map which does make use of the Lookup you illustrated actually didn't need this special null row handling. It would just leave an empty SOAP response with no type elements, just the body.
My preferred map is the one with FlowToIterate since we can process the filter in-database. How does one handle empty rows in that map? Adding tESBProviderFault didn't seem to yield.
I attached 4 screenshots but don't see them reflected in my post. Please let me know if you haven't received them.
0683p000009MC2R.png 0683p000009MC0S.png 0683p000009MCAZ.png 0683p000009MCAe.png
Anonymous
Not applicable
Author

Hi 
Could not generate the XML stream caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at : .

Sorry, I don't understand what you have explained above, can you add a tLogRow before tESBProviderResponse to see what are the output data after join when you get this error?
Best regards
Shong
Anonymous
Not applicable
Author

Hi, Here's my job run with tLogRow output attached.
tLogRowoutput_from_empty_recordset.txt.txt
0683p000009MBwa.png 0683p000009MC5V.png tLogRowoutput_from_empty_recordset.txt_20141231-1942.txt
Anonymous
Not applicable
Author

Hi 
From the log message, we can confirm that this error is caused by empty row. To resolve it, you have to check if the recordset extract from access DB is empty or not first, and then, trigger different processing based on the check result. For example:
tERequest-main-tXMap-tFl..rate-iterate-tAinput1-tHashOutPut-oncomponentok-tJava-runIf1-tHashInput-tXMap-tEsbProviderRes...
                                                                                                                          -runIf2-tFixedFlowInput-tXMap- tEsbProviderRes

tHashOutput: extract the data from DB and store it in memory.
tjava: check if the recordset is empty or not. 
int nb_line=(Integer)globalMap.get("tAccessInput_1_NB_LINE");
if(nb_line==0){
globalMap.put("isEmpty",true);
}else{
globalMap.put("isEmpty", false);
}

Set the condition of runif1 as:
!(Boolean)globalMap.get("isEmpty")

\\It means if the recordset is not empty, read the data from memory and output them.
Set the condition of runIf2 as:
(Boolean)globalMap.get("isEmpty")

tFixeFlowInput: customize a output message if the recordset is empty, for example, define one column on the schema, and customize the value as:
"No rows return"

Best regards
Shong
Anonymous
Not applicable
Author

I don't seem to have tHash* components nor for that matter, a Technical Group under my Talend Open Studio for ESB installation. Do I need to install the Data Integration exe separately?
Anonymous
Not applicable
Author

Talend Data Integration Open Studio doesn't have it either. Is this only available in the Enterprise or Platform offering?