Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Community,
currently I am trying to send the output of tStatCatcher to a Graylog server via a REST API call. The data must be transferred to the API as a JSON string.
I have created the following process:
tStatCatcher -> tXMLMap -> tRESTClient
In the tXMLMap module, the fields are mapped to an XML structure. Finally, the tRESTClient should transmit the data via POST in JSON format. Otherwise, I have not made any other settings.
tXMLMap-Mapping:
tRESTClient-Config:
Unfortunately, when I run the tRESTClient I get an exception that I can't explain:
Exception in component tRESTClient_1 (SYNC_PARTY) javax.ws.rs.ProcessingException: java.lang.IllegalStateException: The entity is not backed by an input stream, entity class is : java.lang.String at org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1148) at org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1117) at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1042) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:895) at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:863) at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:426) at org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:456) at trypartysync.sync_vodster_0_1.SYNC_PARTY.tStatCatcher_1Process(SYNC_PARTY.java:12007) at trypartysync.sync_vodster_0_1.SYNC_PARTY.runJobInTOS(SYNC_PARTY.java:12769) at trypartysync.sync_vodster_0_1.SYNC_PARTY.main(SYNC_PARTY.java:12613) Caused by: java.lang.IllegalStateException: The entity is not backed by an input stream, entity class is : java.lang.String at org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:394) at org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:524) at org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:1129) ... 9 more
Here is the relevant code:
Do you have an idea how I could solve it or what could be the cause of the problem?
Hopefully you have an idea. Otherwise I would try to make a system call with "curl". But that would just be a stupid workaround. It should only be possible to solve it with Talend.
Thanks in advance for you help.
Volker
You do not need to assign a row value to the tRest. Take a look at here (https://help.talend.com/reader/iYcvdknuprDzYycT3WRU8w/_N82Hv0ivAnxD69EWaC5rA). You need to do a bit more work with the tRest, but you can use a tSetGlobalVar to store your computed JSON and add it to the HTTP Body using the globalMap. You can even test by hardcoding some JSON as a String.
Thanks to Rhall's last post, I've got it working like a charm now. Finally 🙂
The statistics are protocolled to my Graylog Server with the help of the HTTP GELF input.
Here is the overview of the working configuration:
The OnComponentOk trigger starts tREST.
Thanks again, Rhall, for your help.
Good work and thanks for doing the write up for others to use in the future