Before convert the body to string, log the response from webservice ( {{dummy.Service}} ) .
On Wed, Apr 17, 2019 at 12:35 AM Omkar Palekar <palekar.omka...@gmail.com> wrote: > hey, > > Can you help with below issue. > > while using Rest DSL response is coming in below format. > ????ds???w?V??S > > While using with CXF:rs response is receiving as expected. > Below is my code for same. > > <?xml version="1.0" encoding="UTF-8"?> > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd"> > > <bean id="reqProcessor" class="org.example.dsl.RequestProcessor" /> > > <camelContext id="camel" xmlns=" > http://camel.apache.org/schema/spring"> > > <dataFormats> > <json library="Jackson" id="json" /> > </dataFormats> > > <restConfiguration component="restlet" host="localhost" > port="8085" bindingMode="json"> > <dataFormatProperty key="prettyPrint" value="true" > /> > <dataFormatProperty key="json.in.disableFeatures" > value="FAIL_ON_EMPTY_BEANS" /> > </restConfiguration> > > <rest> > <post uri="/employee" consumes="application/json" > bindingMode="json"> > <to uri="direct:dummyService" /> > </post> > </rest> > > <route id="test1"> > > <from uri="direct:dummyService" /> > <setHeader headerName="name"> > <jsonpath>$.name</jsonpath> > </setHeader> > <setHeader headerName="salary"> > <jsonpath>$.salary</jsonpath> > </setHeader> > <setHeader headerName="age"> > <jsonpath>$.age</jsonpath> > </setHeader> > <setBody> > <simple>{"name":"${header.name > }","salary":"${header.salary}","age":"${header.age}"}</simple> > </setBody> > <setHeader headerName="Content-Type"> > <simple>application/json</simple> > </setHeader> > > <log message="INTO REQUEST 2 BODY ----------------> > ${body}" /> > > <to uri="{{dummy.Service}}?bridgeEndpoint=true" /> > > <convertBodyTo type="java.lang.String" /> > > > <log message="INTO RESPONSE BODY > ------------------> ${body}" /> > </route> > > </camelContext> > > Regards, > Omkar Palekar >