//Create a DataHandler with the String DataSource object
DataHandler dataHandler = new DataHandler(stringDS);
//Store the data handler in ImageDepot bean
ImageDepot imageDepot = new ObjectFactory().createImageDepot();
imageDepot.setImageData(dataHandler);
Service svc = Service.create(serviceName);
svc.addPort(portName, null, endpointUrl);
JAXBContext jbc = JAXBContext.newInstance("org.test.mtom");
Dispatch<Object> dispatch = svc
.createDispatch(portName, jbc, Service.Mode.PAYLOAD);
//Create a request bean with imagedepot bean as value
ObjectFactory factory = new ObjectFactory();
SendImage request = factory.createSendImage();
request.setInput(imageDepot);
TestLogger.logger.debug(">> Invoking Dispatch<Object> JAXBProviderService");
SendImageResponse response = (SendImageResponse) dispatch.invoke(request);