Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm using Talend Open Sudio for ESB 7.1.1 (free version) and have a simple route: cRest --> cProcessor.
My cRest has "Consumes" and "Produces" set to "JSON".
My cProcessor prints the "in" part of the exchange to the console: System.out.println("in body = '" + exchange.getIn().getBody(String.class) + "'");
When I send a JSON POST request to the cRest without a root node, eg:
{
"mid": "18125",
"portalid": "2013194"
}
I get the following truncated output on the console: in body = '<mid>18125</mid>'. How do I get the rest of the JSON request, ie. <portalid>2013194</portalid> ?
I need all the values in the exchange in body for further processing.
If I send a JSON POST request with a root node, I do get all values from the request (in body = '<root><mid>18125</mid><portalid>2013194</portalid></root>'),
BUT: I can't change the client making the JSON Post, so I'm stuck.
In the Code view for the Route it shows
providers.add(new com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider());
providers.add(new com.fasterxml.jackson.jaxrs.xml.JacksonJaxbXMLProvider());
In the Route POM it shows
<dependency>
<groupId>org.talend.libraries</groupId>
<artifactId>jackson-jaxrs-json-provider-2.9.6</artifactId>
<version>6.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.talend.libraries</groupId>
<artifactId>cxf-rt-rs-client-3.2.6</artifactId>
<version>6.0.0-SNAPSHOT</version>
</dependency>
According to this post, it should just work out of the box:
How can i make this work ?
Your help is greatly appreciated.
Any Solution for this thing?
I ended up parsing the Json values posted to the route with the cCXFRS component instead:
cCXFRS->cConvertBodyTo->cSetHeader
Settings:
1. cCXFRS: HTTP Verb = POST, consumes/produces = JSON, Bean class = String
2. cConvertBodyTo: String
3. cSetHeader: VariableName = test, JsonPath, "<name of Json attribute>", String.class