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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
jmceachern
Contributor
Contributor

How to use tRestClient to POST an XML doc

I want to create a restful web service that performs POST with data in an xml document.

In my job to create the restful service I have the following:

0683p000009MGt8.png

Details on tRESTRequest:

0683p000009MGtD.png


I've tried this on my tRESTClient but it doesn't work:

0683p000009MGtI.png

Basically, I need to understand how to consume a restful web service with my the data to be posted in an xml document.  I need to understand how to do this through a Talend job but also how I would instruct client to use my endpoint to do it.


Here's the schema I'm using for the request flow in the tRestRequest:


0683p000009MGtN.png
Labels (4)
2 Replies
Anonymous
Not applicable

Hello,
In fact, you should not use OnSubjobOk in your first job the web service. In the first job, the only link that you can use is the 'row'. If you want to use the link OnSubjobOK or OnComponentOK, you should use in the job children. So in general, we use the first job for just passing the data in the job children. For passing the document, you should put your document in body. In your component tRESTRequest, you should create the column body and you make the type in Document or String. 
Anonymous
Not applicable

Hi
As louislinlin said, onsubjobok can't be used in provided job of web service, because the tRestRequest always keep listening to work unless you stop the web service, so you need to change the job to use oncomponentok, eg:
tRestRequest--main--tXMLMap--tFileOutputExcel--oncomponentok--tFixedFlowInput--main--tXMLMap--tRestResponse

In the consumer job, if you want to pass directly the xml file as request to the web service when calling, read the root element as a node, see below:
0683p000009MGtS.png

Hope this helps you.

Shong