//Create a DataHandler with the String DataSource object
DataHandler dataHandler = new DataHandler(imageDS);
//Store the data handler in ImageDepot bean
ImageDepot imageDepot = new ObjectFactory().createImageDepot();
imageDepot.setImageData(dataHandler);
//JAXBContext jbc = JAXBContext.newInstance("org.test.mtom");
JAXBBlockContext context = new JAXBBlockContext(SendImage.class.getPackage().getName());
//Create a request bean with imagedepot bean as value
ObjectFactory factory = new ObjectFactory();
SendImage request = factory.createSendImage();
request.setInput(imageDepot);
BlockFactory blkFactory = (JAXBBlockFactory) FactoryRegistry.getFactory(JAXBBlockFactory.class);
Block block = blkFactory.createFrom(request, context, null);