A xml-message encoded in utf-8 containing åäö routed through this route is
trashed. åäö is not åäö after this route. If I remove the marshal call, the
problem goes away.
this.from("direct:request").marshal(soapDataFormat).convertBodyTo(
String.class).to(requestUri);
To be sure that it wasn't my dataformat that trashed it, I wrote this
processor:
final Processor wrapSoap = new Processor() {
public void process(Exchange exchange) throws Exception {
ByteArrayOutputStream outputStream = new
ByteArrayOutputStream();
soapDataFormat.marshal(exchange, new
StringSource((String) exchange.getIn().getBody()), outputStream);
exchange.getOut(true).setBody(outputStream.toString
("UTF-8"));
}
};
and applied this route:
this.from("direct:request").process(this.wrapSoap).convertBodyTo(
String.class).to(requestUri);
And now things are working...
Looking at org.apache.camel.processor.MarshalProcessor.java that is used in
the marshal()-call, is this really ok to do with utf-8 data?
dataFormat.marshal(exchange, body, buffer);
byte[] data = buffer.toByteArray();
out.setBody(data);
--
/Magnus Heino