I am supposed to convert an image into array bytes and send it along with the destination location in a Webservice. I have this code written in beanshell
File file = new File("\\PICS\\k6.jpg");
FileInputStream in = new FileInputStream(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int i=0;
for (int i; (i = in.read(buffer)) != -1; )
{
bos.write(buffer, 0, i);
}
in.close();
byte[] imageData = bos.toByteArray();
bos.close();
vars.put("imageData", new String(imageData));
I am facing this error- An invalid XML character (Unicode: 0x0) was found in the element content of the document.
The variable "imageData" seems to be in ASCII but how to send it along with the request.I need the array object