public ImageDepot sendImage(ImageDepot input) {
TestLogger.logger.debug("[new sendImage request received]");
DataHandler data = input.getImageData();
TestLogger.logger.debug("[contentType] " + data.getContentType());
ImageDepot output = (new ObjectFactory()).createImageDepot();
Image image = null;
try {
ByteArrayInputStream stream = (ByteArrayInputStream) data.getContent();
image = ImageIO.read(stream);
DataSource imageDS = new DataSourceImpl("image/jpeg", "test.jpg", image);
DataHandler handler = new DataHandler(imageDS);
output.setImageData(handler);
}
catch (Exception e) {
throw new WebServiceException(e);
}
return output;