File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes problem with base64Binary Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "problem with base64Binary" Watch "problem with base64Binary" New topic

problem with base64Binary

Theeranit Pongtongmuang

Joined: May 17, 2009
Posts: 19
I've tried to send image to server via mobile and web service wsdl and got problem with base64binary type

For wsdl

When I put this wsdl in J2ME web service client and got

getbase64_func(byte[] image) method for sending image to server

So I've tried this code for MIDlet

and the result I got is the message server doesn 't encode data
I don't know why java parse base64binary to byte[] for getbase64_func method instead of string.
and I don't know the error that might happen converting Stringbase64 to byte[]

Please could you help me to solve this problem.

Rakesh Jhamb
Ranch Hand

Joined: Jun 18, 2003
Posts: 154
Please try below code

File f = new File(filename);
FileInputStream fin new FileInputStream(f);
byte[] buffer = new byte[(int)f.length()];;

Don't use any Base64 encoding.

Now pass buffer to ws.getbase64_func method.

I agree. Here's the link:
subject: problem with base64Binary
It's not a secret anymore!