wood burning stoves*
The moose likes Java in General and the fly likes IGNORE THE PREVIOUS BASE64 QUESTION! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "IGNORE THE PREVIOUS BASE64 QUESTION!" Watch "IGNORE THE PREVIOUS BASE64 QUESTION!" New topic
Author

IGNORE THE PREVIOUS BASE64 QUESTION!

le taylom
Ranch Hand

Joined: Dec 01, 2000
Posts: 44
Hi guys,
Its been a while since i've used these pages, I hope its as good as when I last used them.....
Here's the problem: I am using the following class org.apache.soap.encoding.soapenc.Base64 provided by Apache to do my encoding and decoding. I need to Base64 encode some data as i am then passing it to a SOAP server wrapped in XML. All seems cool, right? Wrong. The code below shows the following steps
1) create Base64 class;
2) read a file on the filesystem into a Byte[] (using a FileInputStream)
3) call the encode method in the Base64 class, passing the byte[];
4) the SOAP function then decodes the data, encrypts it, re-encodes it and then sends it back wrapped in XML
The problem is this, when the SOAP function receives the encoded data it cannot decode for some reason, fails and creates a zero byte file!! I have used a n other 3rd party (online: http://david.carter-tod.com/base64/ ) base64 encoder, encoded some text, put that into file, then repeated the steps above (obviously missing out the encode step) and all worked fine!!!
So, my conclusion is that the base64 encoder I am using is encoding incorrectly. Incorrectly for the SOAP side of things anyway.
My code is below, any thoughts?
I have used 4 different Base64 Encoder classes and all have the same result!
 
wood burning stoves
 
subject: IGNORE THE PREVIOUS BASE64 QUESTION!