On Thu, Jul 7, 2011 at 11:36 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> Hi
>
> Yeah you need a custom codec if you want to handle this properly.
>
> On Thu, Jul 7, 2011 at 11:29 AM, Sushmita chandra
> <flightsoffantasy...@gmail.com> wrote:
>> I am trying to send an XML message to a MINA endpoint and read it back from
>> there and do some processing.But I am not able to get the proper XML back.
>> I tried to use the following syntax:
>>
>> 1   from("mina:tcp://0.0.0.0:9091?sync=true") --->We get an exception where
>> the datalength= 1010792557  is returned along with the hexadecimal values.
>> Seems like incoming XML is not getting decoded properly due to lack of
>> proper codec.
>>
>> 2.  from("mina:tcp://0.0.0.0:9091?sync=true&textline=true”) ---> Then the
>> whole incoming XML query is read one line at a time and the whole processing
>> is also done ,one line at a time.
>>
>
> You can also strip any newline inside the XML so its one long line,
> and only the last character is a newline to denote the end of this
> message.

You can possible strip the newlines from the route if you dont want to
use some java code for that.
Something like

from X
  to Y
  // remove all new lines
  .setBody(body().regexReplaceAll("\n", ""))
  // add newline (you may be able to omit that as camel-mina may auto
detect the end of the msg and append a missing newline)
  .setBody(body().append("\n"))
  .to("mina:xxx")


>
>> In case of HL7 messages there is a codec value called hl7codec that is used
>> to parse the incoming HL7 message. I searched the web for similar codec
>> value for XML message, but I couldn’t find anything as such, so that we
>> could read the whole XML message as a whole.
>> I want to know whether there is any specific codec for XML messages?
>>
>>
>> Thanks,
>> Sushmita
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/What-codec-do-we-need-to-use-for-sending-an-XML-message-to-a-MINA-endpoint-tp4560464p4560464.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to