aspose file tools
The moose likes Java in General and the fly likes Base64 Encoding Decoding java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Base64 Encoding Decoding java" Watch "Base64 Encoding Decoding java" New topic
Author

Base64 Encoding Decoding java

Sanjay Ra
Ranch Hand

Joined: Nov 05, 2004
Posts: 31
Hi,
I am receiving an xml through HTTPServlet request with a data element which is encoded base64
but am unable to decode the data string i even tried an online decoder for base64 but it did not work. Is there something wrong with the way i am getting the data?

thanks
Sanjay

Clobdata <?xml version="1.0"?><request version="1.0"><from node="PSFT_CR"/><to node="AP_VITRIA"/><operations integrationbroker="true" interface="PublishSubscribeSystem" namespace="PublishSubscribe"><invoke member="Publish"><variable interface="Publication" type="object"><publication><publishingnode>PSFT_CR</publishingnode><channel>APC_RAR_CHL</channel><publicationid>31</publicationid><subchannel>PSFT_CR31</subchannel><subject>APC_RAR_MSG</subject><class>PSAPMSG</class><originatingnode>PSFT_CR</originatingnode><publisher>DALLON</publisher><publicationprocess>APC_INTF_RTGR_CMPT</publicationprocess><publishtimestamp>2004-12-14T19 :13:00.000000+0000</publishtimestamp><status/><defaultdataversion>VERSION_1</defaultdataversion><dataversions><publicationdataversion><version>VERSION_1</version><data encodedlength="1168(875)" encoding="base64(deflate)" length="1642">eJx9Vdtu2zgQfS+w/+BNX41Ssr1NUrAsaIlRBVuXkrQduygERmYSLWxJkeSg/vsdXWwrbbFPPHM4M5obR/jLz/1u8KqLMsnSz1fmB+PqC/nrHQ5FsJCecAZlruPPV649/xRne6TyfKfRa1IViUKOTnWRxKeTveq0Kj+Bi/eDPnVFcF4ke1UcZ/pIrq8Nw7iZXI9MjHo0znIr22rCMeoQrpK9Liu1z8nIMCbmyJyYt+bYwOhygSEeoV8OOo21nxHTGI8wess1KpBD8pjEtIK4H4h5MxrSMORMUnfOmTOs7YaXwIa8dfLWCsNHS/Wk5THXpG+OUf8GZ0XyRPPc3dbfgWzOIi50mTcQnZ3NVfoEUrzLHmxVKYL//m7ZVNLv+E99eYfZkvny/3qSbHeoVLnaF1HxGOumJYg/xpba7XoN2kTCjizOqGQR5BJZgS85taSI+J0FDWsMv2q11QVk9PCvjitf7TU6CdAy1Gl 1fIOb1NAbY9cLI2p6TAjqsK+M2owTHHLXo3wdzdgaDILQCmwGQLqgJ6kXAq6jEuzbgvkWi/zgxITMcu9cK6JScncKbOc5kuuwdhFw12kycm2QOBPhRUJ/jKUm7zeCnktA8HLK5j4YbDZhIKKanUX+lNdzODZM42b1ol9ujW35z0eMftXBdEG5JJuQ2xi1GM9WHvMdAqPbITyT7F6+eQstgz0qfXCCutNncsVrwxbgFWUcAkTduZwFHLyh7lzKFXPI0jTAoMVYhHUEoqFajKeC8hmZAuXfC4xaEc+p7ywI8zFqEXZD625OnVPdfimRpNMz1TKbzYpNQ9euoz1jPFv4TT7d6VOPmYSmSbo9qoH1rA7b50ORQH7NBRaSMyYJzav3g4/GeMBUWQ0h8pZuzEek1R614rgTx6046UQ4LVeuTSIOaXp8VTuNUUs0/IgIlVYQwU4Vqr0Z1ePiuIFPLIpRB7EVLCDnNVlApU4YQ8dlVM+sSW4nxg1 MQY/BwpMwZrZdp93Dks0jf+FN65lDfaGpd13m32t6YgTjLp37AThnHOoI89ICLAIu7/rGF1XULAvy4wfAy4KpClVvFR0U8Dyb9xofigIe7DyLVQXLBhhYrtWhrB91UWSF1D8rwM+qnCYprOvaT22W7XPYaKWufcCyLY551eCHvhY6/UjIfyW1+k0=</data></publicationdataversion></dataversions></publication></variable></invoke></operations></request>
localName publishingnode
Randall Julian
Greenhorn

Joined: Nov 21, 2004
Posts: 14
I was able to open your XML in XMLSpy and it all looks OK, except that I cannot tell what format the binary data is in. Base64 is a way of encoding binary format data into printable bytes for transmission. You have to know what format it started in before it was encoded in order to decode it. Otherwise you just get back an array of bytes.

I have been working on encoding and decoding lists of floats and doubles and the schema I'm working with specifies the length and the endianess of the float so that other programs can figure out what the bytes they get back from the decode mean.

Before you can go further, you have to know the format of the original binary data.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12265
    
    1
When you say "it didn't work" what do you mean? Did it throw an exception or is it just that you can't interpret the result.
The Apache SF commons project has a base64 toolkit.
Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Base64 Encoding Decoding java
 
Similar Threads
to EXACT Dublicate an xml file[xml->xml] via Java TransformerFactory classes and XSTL well I do not
really need some help here concerning treeNode data types and the like. (data type issues really)
XSLT questions
schema and namespaces
Illegal XML character &#x0;