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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

A Simple JSON tRestRequest and send JSON payload to tRestClient

 

Hi,

I am trying to create a job which accept JSON request from tRestRequest and transfer same to tRestClient. This should be some simple process and I may be missing something here.

 

Sample Json

{
"Reference":"12345",
"Files":[
{
"FileName":"test.png",
"FileData":"iVBORw0KGgoAAAANI=",
"FileUrl":""
}
]

}

 

Probelm:

1- If I am using body --> Document , my client is receiving only first root 

{"Reference":"12345",}

 

2- If I am using body --> String , my client is receiving Blank body

|body|

|=--=|

|    |

'----'

 

Reference from Job

 

0683p000009M90c.png

 

0683p000009M8kQ.png

 

Thanks,

Za

Labels (5)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

Issue was when I tried to call Job 2 (tRestRequest) from Job 1 (tRestClient). Job 2 was receiving blank body.

 

I am able to solve this problem by mapping tMap to tRestClient like this. I did not touch the body.

tMap.                      ----> tRest Client

string -> String       -----> string String             

                                        Body. --> Document

Also Checked WRAP JSON request in tRequest in first job.

 

Job 1 is Talent and Job 2 was internal Talend Job. Job 2 was mocking actual outside server. Internal Talend Jobs are working fine.

New Problem 

When i tried to call outside server from Job 1 (tRestClient )as per my attached picture. It is given me following error.

Exception in component tRESTClient_1 (testnew)

javax.ws.rs.client.ResponseProcessingException: No message body reader has been found for class org.dom4j.Document, ContentType: text/html;charset=utf-8

at org.apache.cxf.jaxrs.impl.ResponseImpl.reportMessageHandlerProblem(ResponseImpl.java:437)

at org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:390)

at org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:314)

 

0683p000009M960.png

 

 

 

View solution in original post

3 Replies
uzix
Creator
Creator

hello,

 

in the restRequest check the "output flow"  and name it to "body" and set  type "String" -> see pic 1

sync columns on next components 

on tRestClient check the "input schema"  (should be "body" type "String") --> see pic 2

check pic 3 to see my tlogRow after restRequest 

 

regards

 


rest_1.jpg
rest_2.jpg
rest_3.jpg
Anonymous
Not applicable
Author

Hi,

Issue was when I tried to call Job 2 (tRestRequest) from Job 1 (tRestClient). Job 2 was receiving blank body.

 

I am able to solve this problem by mapping tMap to tRestClient like this. I did not touch the body.

tMap.                      ----> tRest Client

string -> String       -----> string String             

                                        Body. --> Document

Also Checked WRAP JSON request in tRequest in first job.

 

Job 1 is Talent and Job 2 was internal Talend Job. Job 2 was mocking actual outside server. Internal Talend Jobs are working fine.

New Problem 

When i tried to call outside server from Job 1 (tRestClient )as per my attached picture. It is given me following error.

Exception in component tRESTClient_1 (testnew)

javax.ws.rs.client.ResponseProcessingException: No message body reader has been found for class org.dom4j.Document, ContentType: text/html;charset=utf-8

at org.apache.cxf.jaxrs.impl.ResponseImpl.reportMessageHandlerProblem(ResponseImpl.java:437)

at org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:390)

at org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:314)

 

0683p000009M960.png

 

 

 

uzix
Creator
Creator

hi, 

 

are you able to call "outside server" via postman for example ? 

put a tlogrow after tmap to see what your sending to trestclient

-in trestclient check advanced settings and check:

.log messages

.drop json request root

.wrap json response

basic settings:

content type : this value depend on server - try json

accepttype: this value depend on server - try json