dani77
dani77

Reputation: 319

Apache Camel wrong response JSON - UTF8

I have this configuration for Apache Camel Rest service:

<route id="RouteWebAutorizacion">
    <from uri="jetty:http://{{web.host}}:{{web.port}}/autorizacion"/>
    <convertBodyTo type="java.lang.String" charset="UTF-8"/>
    <removeHeaders pattern="Camel*"/>
    <setHeader headerName="MessageKey">
        <jsonpath>$.id</jsonpath>
    </setHeader>
    <process ref="WebAutorizacion"/>
    <setHeader headerName="Content-Type">
        <constant>application/json; charset=utf-8</constant>
    </setHeader>
    <removeHeaders pattern="*"/>
</route>

I don't have access to Camel project code. I only have access to xml configuration files.

I send a JSON in the request like this:

{
   "id" : "142",
   "monto" : "100.50",
   "idComercio" : "4555"
}

I have to receive a JSON as response with Spanish or Portuguese text with 'tildes'. But I am receiving an XML with extrange characters.

<data contentType="null" contentLength="96"><!CDATA[{"token":"45888","error":"00","descripcion":"Transacción OK","id":"142"}]]></data>

I need to receive a JSON instead an XML.

The JSON must be like this:

{"token":"45888","error":"00","descripcion":"Transacción OK","id":"142"}

What I have wrong in my configuration or what I am missing?

I send the requests via SOAP UI and it shows this message in the JSON tab:

The content you are trying to view cannot be viewed as JSON

Thanks.

Upvotes: 0

Views: 1348

Answers (0)

Related Questions