}
private OMElement createEnvelope(String fileName) throws Exception {
DataHandler expectedDH;
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
OMElement data = fac.createOMElement("mtomSample", omNs);
OMElement image = fac.createOMElement("image", omNs);
Image expectedImage;
expectedImage = new ImageIO()
.loadImage(new FileInputStream(inputFile));
ImageDataSource dataSource = new ImageDataSource("test.jpg",
expectedImage);
expectedDH = new DataHandler(dataSource);
OMText textData = fac.createText(expectedDH, true);
image.addChild(textData);
OMElement imageName = fac.createOMElement("fileName", omNs);
if (fileName != null) {
imageName.setText(fileName);
}
//OMElement wrap = fac.createOMElement("wrap",omNs);
data.addChild(image);