// Create a DataSource from a String
stringDS = new org.apache.axiom.attachments.ByteArrayDataSource(sampleText.getBytes(), "text/plain");
// Create a DataSource from an image
File file = new File(imageResourceDir + File.separator + "test.jpg");
ImageInputStream fiis = new FileImageInputStream(file);
Image image = ImageIO.read(fiis);
imageDS = new DataSourceImpl("image/jpeg", "test.jpg", image);
}