• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

problem with base64Binary

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Thanks
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please try below code

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

Don't use any Base64 encoding.

Now pass buffer to ws.getbase64_func method.
 
reply
    Bookmark Topic Watch Topic
  • New Topic