How did you check the header in the exchange ?
Did you use exchange.toString() or something like that ? The encoding
may have been lost in the process of making the exchange re-readable.
On Thu, Jul 3, 2008 at 3:29 PM, Javier Valdes
<[EMAIL PROTECTED]> wrote:
> We think that there is no problem with the StreamSource. When we debuged we
> see that the message was correct except in the MessageExchange (InOnly
> exchange).
>
> Thanks
>
> 2008/7/3 Guillaume Nodet <[EMAIL PROTECTED]>:
>
>> Doesn't the StreamSource has a way to set the content encoding for the
>> given stream ?
>>
>> On Thu, Jul 3, 2008 at 1:18 PM, Javier Valdes
>> <[EMAIL PROTECTED]> wrote:
>> > Hi,
>> >
>> > We have made our own binding component and we have a problem with the
>> > encoding. We are using Servicemix 3.2.1
>> >
>> > The message that we received used ISO-8859-1, and our code is this:
>> >
>> >
>> ********************************************************************************************
>> >
>> > protected void processMessage (InputStream entrada, int socketId, int[]
>> > eofDelim)
>> > throws Exception
>> > {
>> > InOnly exchange = getExchangeFactory().createInOnlyExchange();
>> > configureExchangeTarget(exchange);
>> > NormalizedMessage message = exchange.createMessage();
>> > message.setProperty("socketId", Integer.valueOf(socketId));
>> > exchange.setInMessage(message);
>> >
>> > String messageContent = readMessage();
>> >
>> > message.setContent(new StreamSource(new
>> > StringReader(messageContent)));
>> >
>> > try
>> > {
>> > sendSync(exchange);
>> > }
>> >
>> > catch (Exception e)
>> > {
>> > mLogger.error("We had an exception in Socket Reader: " + e);
>> > e.printStackTrace();
>> > return;
>> > }
>> > }
>> >
>> ********************************************************************************************
>> >
>> > Where readMessage read the message content from a socket. We have debuged
>> > the code and the messageContent is readed correctly (with the correct
>> > ISO-8859-1 encoding) with this header:
>> >
>> > <?xml version='1.0' encoding='ISO-8859-1'?>
>> >
>> > When we set the content of the NormalizedMessage the content is still
>> > correct, with the same xml header. But the exchange has this header (and
>> the
>> > message is sended to the bus in this way):
>> >
>> > <?xml version="1.0" encoding="UTF-8"?>
>> >
>> > We have set the charset to ISO-8859-1 in the servicemix.properties files
>> but
>> > we have the same problem.
>> >
>> > How can we fix this problem?
>> >
>> > Thanks
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/