Search code examples
javasoapdatahandler

Custom DataHandler for SOAP using Java


I am having an application where two processes talk using SOAP. A file is being transferred from Process A to Process B. Where Process B will store it to DB.

opqData.setBase64Binary(new DataHandler(new FileDataSource(file)));

where file is the data which needs to be stored to the DB. However now i want to zip the data when storing it to DB. One option is to zip the file and send it as FileDataSource. However i cant use it because we have more than 1000 such files and it creates a lot of zip entries in the file structure and creating the zip is additions overhead.

So i was thinking to implement the DataHandler as GzipDataHandler and the input stream returned is gzipInputStream to process B. So the data will be zipped and stored to the DB.

However i am confused how to write the getInputStream method for my new GzipDataHandler.

Has any one tried something like this before? Or can i get any pointers from Java and SOAP experts?

Thanks,
Dheeraj Joshi


Solution

  • This might help you:

    http://www.exampledepot.com/egs/java.util.zip/CompressFile.html