This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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!