You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Bernard Lupin <be...@yahoo.fr> on 2006/10/13 19:42:19 UTC
usage of SourceTransformer
Hi all,
After a long debugging I finally focused why my service don't work : It
seems that the SourceTransformer.toString method is altering my parameter.
For exemple, this code :
public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
try {
log.info("First : " + (new
SourceTransformer()).toString(exchange.getMessage("in").getContent()));
log.info("Second : " + (new
SourceTransformer()).toString(exchange.getMessage("in").getContent()));
} catch(TransformerException e) {log.info(e); }
}
produce the following output :
- First : <?xml version="1.0" encoding="UTF-8"?><hello>world</hello>
- Second : <?xml version="1.0" encoding="UTF-8"?>
So my input message is wrong and my service fails.
Could you tell me why the two responses are not equal, and how do I have to
manage with the SourceTransformer class ?
Many thanks,
Bernard
--
View this message in context: http://www.nabble.com/usage-of-SourceTransformer-tf2438705.html#a6800497
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: usage of SourceTransformer
Posted by Guillaume Nodet <gn...@gmail.com>.
The main reason I see is that the message you are receiving
contains a stream. In such a case, you can only read it once.
There are a bunch of helper functions in
org.apache.servicemix.jbi.util.MessageUtil
that you can use to copy / tranfer messages.
On 10/13/06, Bernard Lupin <be...@yahoo.fr> wrote:
>
> Hi all,
> After a long debugging I finally focused why my service don't work : It
> seems that the SourceTransformer.toString method is altering my parameter.
> For exemple, this code :
>
> public void onMessageExchange(MessageExchange exchange) throws
> MessagingException {
> try {
> log.info("First : " + (new
> SourceTransformer()).toString(exchange.getMessage("in").getContent()));
> log.info("Second : " + (new
> SourceTransformer()).toString(exchange.getMessage("in").getContent()));
> } catch(TransformerException e) {log.info(e); }
> }
>
> produce the following output :
>
> - First : <?xml version="1.0" encoding="UTF-8"?><hello>world</hello>
> - Second : <?xml version="1.0" encoding="UTF-8"?>
>
> So my input message is wrong and my service fails.
> Could you tell me why the two responses are not equal, and how do I have to
> manage with the SourceTransformer class ?
> Many thanks,
> Bernard
> --
> View this message in context: http://www.nabble.com/usage-of-SourceTransformer-tf2438705.html#a6800497
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>
--
Cheers,
Guillaume Nodet