aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "problem with base64Binary" Watch "problem with base64Binary" New topic
Author

problem with base64Binary

Theeranit Pongtongmuang
Greenhorn

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.

Thanks
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()];
fin.read(buffer);
fin.close();

Don't use any Base64 encoding.

Now pass buffer to ws.getbase64_func method.


SCJP2, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with base64Binary
 
Similar Threads
How to access byte array web method
error in wsdl
ws-i compliance questions
Cannot create service instance, service 'x' not found in wsdl
Problem with wsimport based pulling from Websphere-7