OMText binaryNode = (OMText) imageEle.getFirstOMChild();
String fileName = imageName.getText();
//Extracting the data and saving
DataHandler actualDH;
actualDH = (DataHandler)binaryNode.getDataHandler();
Image actualObject = new ImageIO().loadImage(actualDH.getDataSource()
.getInputStream());
FileOutputStream imageOutStream = new FileOutputStream(fileName);
new ImageIO().saveImage("image/jpeg", actualObject, imageOutStream);
//setting response
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace ns = fac.createOMNamespace("urn://fakenamespace", "ns");
OMElement ele = fac.createOMElement("response", ns);
ele.setText("Image Saved");