Hi all,

Here is my case,
i have a body containing some Unicode characters, this body is the RESPONSE of 
a JDBC connection Query.

In camel 2.x i was using xmljson to convert Unicode data into UTF-8 encoding.

i try to convert this service to camel 3.X but xmljson is deprecated and don,t 
find another way.

Someone as a clue to achieve this by another way.

Thank's 


Daniel


==========================================================================
Here how i achieved this in camel 2.x to convert Special Unicode Character to 
UTF-8 encoding.

<to uri="XXXoracleSqlStored:XXX_pkb_apx_service_ords.p_verif_ident(VARCHAR 
${header.XXXCodepgm}, VARCHAR ${headers.XXXid}, OUT VARCHAR jsonString)" /> 
<setBody><simple>${body[jsonString]}</simple></setBody>
<!-- convert UTF-8  XML -->
<unmarshal><xmljson encoding="UTF-8"/><unmarshal>
<!-- goback to JSON converted -->
<marshal><xmljson encoding="UTF-8"/><marshal>


Explanation:

<to uri="XXXoracleSqlStored:XXX_pkb_apx_service_ords.p_verif_ident(VARCHAR 
${header.XXXCodepgm}, VARCHAR ${headers.XXXid}, OUT VARCHAR jsonString)" />

BODY CONTENT (type : java.util.LinkedHashMap ) {jsonString={
"codeRetour":200
,"msgRetour":"succes"
,"msgCourt":"L\u0027identification a r\u00E9ussi."
,"msgLong":"L\u0027identification du dossier du client a r\u00E9ussi."
}
}


Retrieving jsonString content in the Body 
<setBody><simple>${body[jsonString]}</simple></setBody>

BODY CONTENT (type : java.lang.String)
{
"codeRetour":200
,"msgRetour":"succes"
,"msgCourt":"L\u0027identification a r\u00E9ussi."
,"msgLong":"L\u0027identification du dossier du client a r\u00E9ussi."
}


Unmarshal to XML with jsonxml to convert unicode character with UTF-8

<unmarshal><xmljson encoding="UTF-8"/><unmarshal> BODY CONTENT:
<?xml version="1.0" encoding="UTF-8"?>
<o><codeRetour>200</codeRetour><msgCourt>L'identification du dossier du client 
a réussi.</msgCourt> <msgLong>L'identification du dossier du client a 
réussi.</msgLong><msgRetour>succes</msgRetour></o>

Marshal to JSON again with jsonxml.
<marshal><xmljson encoding="UTF-8"/><marshal> BODY CONTENT:
{"codeRetour":"200","msgCourt":"L'identification du dossier du client a 
réussi.", "msgLong":"L'identification du dossier du client a 
réussi.","msgRetour":"succes"}




Daniel Langevin

Reply via email to