JDeveloper Asked: 2020-08-02 07:50:03 +0800 CST 2020-08-02 07:50:03 +0800 CST 2020-08-02 07:50:03 +0800 CST To send an image to a webservices, do I have to encode it to Base64? [closed] 772 I would like to know if to send the image from java I must first encode it. java 2 Answers Voted panterozo 2020-08-02T13:20:10+08:002020-08-02T13:20:10+08:00 You can use MTOM (since Java 6) JAX-WS MTOM , or as a base 64 string, as Elenasys says. Best Answer Jorgesys 2020-08-02T13:01:21+08:002020-08-02T13:01:21+08:00 It seems to me that you are referring to how to send the byte array of an image in a Web Service, to send it, having the byte array, as you mention, you have to encode it in Base64this way: String miImagen = Base64.encodeToString(byteArray, Base64.DEFAULT); miImagenwould be the value that you would send in the WebService.
You can use MTOM (since Java 6) JAX-WS MTOM , or as a base 64 string, as Elenasys says.
It seems to me that you are referring to how to send the byte array of an image in a Web Service, to send it, having the byte array, as you mention, you have to encode it in
Base64
this way:miImagen
would be the value that you would send in the WebService.