HI All,
I am facing a strange problem , sample code is given below for the
illustration of the issue.
I am attaching some text as attachment in the flow and trying to read the same
, doesn't work.
---------Code sample -------
String xml = "<test></test>";
InputStream is = new ByteArrayInputStream(xml.getBytes());
ByteArrayDataSource byteArrayDS = new ByteArrayDataSource(is, "text/xml");
DataHandler fbAttachment = new DataHandler(byteArrayDS,"text/xml");
exchange.getMessage("in").addAttachment("testAttachment", fbAttachment);
InputStream inStream =
exchange.getMessage("in").getAttachment("testAttachment").getInputStream();
byte[] byteArray= IOUtils.toByteArray(inStream);
LOG.info("Sending test attachment : "+ new String(byteArray));
----------------------------------
Environment details :
Java version : java-1.7.0-openjdk-1.7.0.65.x86_64/
Servicemix Version : 3.4.0
Any help is appreciated.
Regards,
Kishore.