Four Stars

Fetch value from database and insert into XML file in runtime

Hi ,

 

I am new to talend ESB, i am trying to fetch customer id by connecting to database and i am getting ex: 10 customer id's like(101,102,103......) now i want to iterate this value and insert into xml file dynamically.

 

please help me on this.

 

  • ESB
6 REPLIES
Community Manager

Re: Fetch value from database and insert into XML file in runtime

Hello
Is it a new XML file for each id? Can you show us an example of XML file to explain your requirement?

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: Fetch value from database and insert into XML file in runtime

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://v2_3.customer.webservices.csx.dtv.com/">
<soapenv:Header/>
<soapenv:Body>
<v2:searchCustomers>
<customerData>
<CustomerID></CustomerID>
</customerData>
<securityUserId><securityUserID>
</v2:searchCustomers>
</soapenv:Body>
</soapenv:Envelope>

 

This is my input XML, where i need to pass value in runtime to securityiD and customerID. I am fetching these two values by querying database. 

Four Stars

Re: Fetch value from database and insert into XML file in runtime

I am new to talend,please find attached screenshot (workflow.png) for the workflow i created.

Here i am to get values in tjava 

String cust_id=((String)globalMap.get("row1.CUST_ID"));
String create_user=((String)globalMap.get("row1.CREATE_USER"));

 

i have set these two variables and using the same in tXMLMap

 

please find attached screenshot txmlmap.png

But the values are not getting passed. please find below error .

 

<S:Envelope xmlnsSmiley Frustrated="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
<faultcode>SSmiley Frustratederver</faultcode>
<faultstring>The user supplied is not a valid Relate user.</faultstring>
<detail>
<ns2:RelateProcessingException xmlns:ns2="http://v2_3.customer.webservices.csx.dtv.com/">
<faultDetail>RelateProcessingException The user supplied is not a valid Relate user. CustomerServicesUtil:validateRelateUser:363 CustomerWebServiceImpl:validateRequest:75 CustomerWebServiceImplSmiley Tonguerocess:66</faultDetail>
<message>The user supplied is not a valid Relate user.</message>
<relateExceptionCode>INVALID_USER</relateExceptionCode>
</ns2:RelateProcessingException>
</detail>
</S:Fault>
</S:Body>
</S:Envelope>

 

I don know whether its correct flow or not please guide me on the same.

 

Four Stars

Re: Fetch value from database and insert into XML file in runtime

 
Community Manager

Re: Fetch value from database and insert into XML file in runtime

Do you use a tFlowToIterate in the job to iterate the the input rows? I don't understand why you use a tJava component. Can you please a screenshot of your job?
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: Fetch value from database and insert into XML file in runtime

Hi ,

 

I am using tflowtoiterate and iteratetoflow component. As i am new i don know all the components available. 

 

please find attached screen shot(job image) i got the output(please let me know is this wrong process,I didnt work in talend so i don have much idea). But now i want to pass this response as input for the other web service will be invoked.(job 1 image)

i have done the flow its giving me an error:

 

Execution failed : Failed to generate code.
[org.eclipse.emf.codegen.jet.JETException: InvocationTargetException in WORKING1 job]
Job WORKING1 ended at 17:51 09/08/2017. [exit code=0]

 

Kindly help me on the same.

 

 

JOB.pngJob1.png

 

Thanks,

Padmini