tRestClient error when receiving JSON

One Star

tRestClient error when receiving JSON

Hello,
When i try to retrieve a JSON object using tRestClient component i get it incomplete and an error is thrown as seen below:
--------------------------------------
Mar 28, 2014 3:44:44 PM org.apache.cxf.jaxrs.client.AbstractClient reportMessageHandlerProblem
SEVERE: .Problem with reading the response message, class : interface org.dom4j.Document, ContentType : application/json.
Exception in component tRESTClient_1
javax.ws.rs.client.ClientException: .Problem with reading the response message, class : interface org.dom4j.Document, ContentType : application/json.
at org.apache.cxf.jaxrs.client.AbstractClient.reportMessageHandlerProblem(AbstractClient.java:761)
at org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:510)
at org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1109)
at org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1093)
at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1043)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:857)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:831)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:394)
at org.apache.cxf.jaxrs.client.WebClient.get(WebClient.java:573)
at swqldashboardjson.dashboard_0_1.Dashboard.tRESTClient_1Process(Dashboard.java:994)
at swqldashboardjson.dashboard_0_1.Dashboard.runJobInTOS(Dashboard.java:1246)
at swqldashboardjson.dashboard_0_1.Dashboard.main(Dashboard.java:1111)
Caused by: javax.ws.rs.BadRequestException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
at org.apache.cxf.jaxrs.provider.json.JSONProvider.readFrom(JSONProvider.java:258)
at org.apache.cxf.jaxrs.provider.dom4j.DOM4JProvider.readFrom(DOM4JProvider.java:70)
at swqldashboardjson.dashboard_0_1.Dashboard$2.readFrom(Dashboard.java:948)
at org.apache.cxf.jaxrs.provider.dom4j.DOM4JProvider.readFrom(DOM4JProvider.java:41)
at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1280)
at org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:506)
... 10 more
Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
at com.sun.org.apache.xerces.internal.dom.ElementNSImpl.setName(Unknown Source)
at com.sun.org.apache.xerces.internal.dom.ElementNSImpl.<init>(Unknown Source)
at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createElementNS(Unknown Source)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.createAndAddElement(W3CDOMStreamWriter.java:150)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.writeStartElement(W3CDOMStreamWriter.java:105)
at org.apache.cxf.staxutils.StaxUtils.writeStartElement(StaxUtils.java:768)
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:706)
at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:694)
at org.apache.cxf.jaxrs.provider.json.JSONProvider.copyReaderToWriter(JSONProvider.java:395)
at org.apache.cxf.jaxrs.provider.json.JSONProvider.readFrom(JSONProvider.java:218)
... 15 more
Can you please tell me what is the problem?
Moderator

Re: tRestClient error when receiving JSON

Hi,
Have you already checked component reference TalendHelpCenter:tRESTClient? Could you please post your job design and tRestClient component setting screenshots into forum so that we can address your issue quickly.
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.
One Star

Re: tRestClient error when receiving JSON

Hi,
I want to take the data from database through API and it is in json. So can please tell me how to take data from database through API.
Which components should i use.
Thanks,
Jandi.
Seventeen Stars

Re: tRestClient error when receiving JSON

There are plenty of database input components. after reading the column containing the json content you can use tExtractJSONField to parse the content.