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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

using Rest with POST XML

Hi,
I have a job that is a REST service in which I use XML to pass data to and it returns XML. The data is posted to it using POST.
So in the job I mapped for the incoming an field named id
However I do not know how to pass the data to it. I did a POST (content type application/xml ) with an xml like this:
123
But the job in talend fills in null for the id. I am not exacly sure what the problem is, is my POST data structure not correct? or is it not possible to use the tRESTREquest directly like this with an incoming XML and should another component extract the XML fields from the RestRequest?

Labels (4)
12 Replies
Anonymous
Not applicable
Author

Hi,
I've created a short tutorial how to use the tRESTRequest in combination with POST XML below:
1. Create flow as shown in the RESTRequestExampleREST_POST_XML screenshot
--> The body is set to "Document", this will hold the XML payload
2. In the tXML component (see xmlMapExampleREST_POST_XML screenshot), define the schema schema for the body, in this case I used a simple schema:
<ROOT>
<ID></ID>
</ROOT>
3. Map the xml fields to your target schema, in this case "messageContent" of type String
4. The messageContent is printed using the tLogRow (using TablePrint)
5. The tRESTResponse is default (returns 200 OK)

Now, start the job and run the command below to test:
curl -X POST -H "Content-Type: application/xml" -H "Accept: application/xml" -d "<ROOT><ID>123</ID></ROOT>" http://127.0.0.1:8090/myRESTService/publishId
As a result, you have the tLogRow component printing the value of <ID>:
| tLogRow_1 |
|=------------=|
|messageContent|
|=------------=|
|123 |
'--------------'
That's all.
Robin
0683p000009MA5T.jpg
Anonymous
Not applicable
Author

Great, many thanks Robin !
Anonymous
Not applicable
Author

Hello. try to do as rhuiser wrote and i have a null result. Can't understand, what I am doing wrong