Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Problem: tRESTResponse Not Giving Data Passed in a JSON Request

Hi,
I have a job that should:

Accept a JSON or XML document as request (tRESTRequest - HTTP Verb: POST, Consumes: XML or JSON, Produces: XML or JSON)
Get the field values from the request document at the first tXMLMap and pass them onto tLogRow
Pass the field values from tLogRow to the next tXMLMap
Create the response document at the second tXMLMap and pass it onto tRESTResponse component
Job design is shown below:
0683p000009MEep.png
I am using SoapUI for testing and when I send in an XML document (SoapUI Media Type: application/xml) as request (ID as 123), tLogRow prints the ID and I get the XML document as response with the ID number 123 present in the ID tag (Shown in the two screenshots below).
0683p000009MEeu.png
0683p000009MEbm.png
The problem is that when I send in a JSON document (SoapUI Media Type: application/json) as request (Again ID as 123), tLogRow does not print the ID and I get an XML document as response but the ID tag is empty (Shown in the two screenshots below). Also, I checked the JSON tab in SoapUI response section and it shows <Not JSON content> which makes me think (Please correct me if i am wrong) that the response is always an XML document although at tRESTRequest component has "XML or JSON" under the "Produces" column in rhe REST API Mapping section under the Basic Settings tab.
0683p000009MEdx.png
0683p000009MEbr.png
I would greatly appreciate your help in resolving this issue.
Thanks
Labels (6)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Problem solved, it was to do with the square brackets. Changing to curly braces worked.
Many thanks andrey.s

View solution in original post

2 Replies
Anonymous
Not applicable
Author

I'm not sure it is the reason, but according to your screenshot your JSON has an array in object "Company". Will it work if you will change this array to a single object? In other words, just change "" to "{" and "}".
Anonymous
Not applicable
Author

Problem solved, it was to do with the square brackets. Changing to curly braces worked.
Many thanks andrey.s