One Star

tRESTClient component is giving weird error for JSON response.

Hi all,
I am new to TOS for DI. I am working on getting data from REST web service. I used tREST which works perfectly but now I need authentication so I am shifting to tRESTClient. tRESTClient work fine when the response is in XML format but when I gave same URL which return JSON data in tREST and tRESTClient, in tREST it works fine but in tRESTClient it gives me following error: 
Sep 5, 2014 11:40:31 AM org.apache.cxf.jaxrs.client.AbstractClient reportMessageHandlerProblem
SEVERE: .No message body reader has been found for class : interface org.dom4j.Document, ContentType : application/x-javascript.
Exception in component tRESTClient_1
javax.ws.rs.client.ClientException: .No message body reader has been found for class : interface org.dom4j.Document, ContentType : application/x-javascript.
at org.apache.cxf.jaxrs.client.AbstractClient.reportMessageHandlerProblem(AbstractClient.java:756)
at org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:523)
at org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1146)
at org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1130)
at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1072)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:878)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:852)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:410)
disconnected
at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:594)
at sample.testjob_3_0_1.testJob_3.tRESTClient_1Process(testJob_3.java:633)
at sample.testjob_3_0_1.testJob_3.runJobInTOS(testJob_3.java:1022)
at sample.testjob_3_0_1.testJob_3.main(testJob_3.java:881)
Job testJob_3 ended at 11:40 05/09/2014.
Although when I check "log messages" in tRESTClient component advance settings, it returns the response with error.
Thanks in advance for any kind of help.
1 REPLY
Moderator

Re: tRESTClient component is giving weird error for JSON response.

Hi,
Did you post json request using tRestClient? What's your input file and job design? Component setting screenshots will be preferred.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.