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

Highlighted
One Star

[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:

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).


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.


I would greatly appreciate your help in resolving this issue.
Thanks

Accepted Solutions
One Star

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

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

All Replies
One Star

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

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 "}".
One Star

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

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

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

APIs for Dummies

View this on-demand webinar about APIs....

Watch Now