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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

POST request with JSON data to tRESTClient component

How can I create POST request with JSON data using tRESTClient component? I can only successfully send XML Document. Should I put JSON data inside XML element? It seems that is the only way to send JSON data. I am using talend 5.5.1.
Labels (5)
35 Replies
Anonymous
Not applicable
Author

You need to give us screenshots of your tRESTClient and your tRESTRequest configurations (schemas, Advanced tab, etc).
Anonymous
Not applicable
Author

client side
0683p000009MDvg.png 0683p000009MEGO.png
service side
0683p000009MEFM.png 0683p000009ME3L.png
I didn't change any advance settings except log messages.
Anonymous
Not applicable
Author

For the tRESTClient you should set both the Content Type and Accept Type to JSON. Only pass the JSON to the "string".
As a test for the service, connect the tRESTRequest to a tLogRow before the tXMLMap.
Anonymous
Not applicable
Author

I added JSON to the string in the tRESTClient component so tXMLmap looks like this.
0683p000009ME0v.png
Now After running I get this error:
Exception in component tRESTClient_2
javax.ws.rs.NotFoundException


And on the service side I get:
Trying to write END_DOCUMENT when document has no root (ie. trying to output empty document).
Anonymous
Not applicable
Author

Use tMap instead of the txmlmap. If not, txmlmap will create the xml in the body even if you don't put anything in this field.
Lin LIN
Consultant BI/Talend
Synaltic Group
Anonymous
Not applicable
Author

Did you use a tLogRow before the tMap? You need to see exactly what you are getting from the tRESTRequest.
Anonymous
Not applicable
Author

Use tMap instead of the txmlmap. If not, txmlmap will create the xml in the body even if you don't put anything in this field.

I replaced tXMLMap on service side and client side with tMap. And now I get on clide side still:
Exception in component tRESTClient_2
javax.ws.rs.NotFoundException

And on the service side I get
java.io.IOException: Illegal character: <<>

And inside tlogrow before tMap
.-----------------------------------------------------------+------.
|                            tLogRow_6                             |
|=----------------------------------------------------------+-----=|
|body                                                       |string|
|=----------------------------------------------------------+-----=|
|<?xml version="1.0" encoding="UTF-8"?>
<ORDER>25000</ORDER>|null  |
'-----------------------------------------------------------+------'
Anonymous
Not applicable
Author

That is working then. Look at the body field. It has converted your JSON to XML
Anonymous
Not applicable
Author

So there is still the problem? If yes, could you put some screenshots? For better managing your body, i advise you to choose the option 'Wrap JSON Request' in the component tRESTRequest if that exists.

Lin LIN
Consultant BI/Talend
Synaltic Group
Anonymous
Not applicable
Author

That is working then. Look at the body field. It has converted your JSON to XML

How should I convert this to JSON ?
I checked 'Wrap JSON Request'.
So there is still the problem? If yes, could you put some screenshots?

I still have the problem
0683p000009ME4o.png 0683p000009MEGT.png