aspose file tools*
The moose likes Web Services and the fly likes Axis Base64.encode Out of Memory Error. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis Base64.encode Out of Memory Error." Watch "Axis Base64.encode Out of Memory Error." New topic
Author

Axis Base64.encode Out of Memory Error.

Charles Ben
Greenhorn

Joined: Jun 02, 2009
Posts: 8
Requirement is to upload more than 600 documents to a server using webservice.
And im using axis Base64.encode method to encode the byte[] and before calling the webservice method.
Many a times im getting out of memory error at this encoding which i believe is caused when the file size is more than 1 MB.
Im converting the byte[] to Base64 Encoded String and convert it back to byte[] for uploading.

Any suggestions or better way to do this and prevent OOM error ..?


Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
You are not saying what kind of way your client uses to assemble SOAP messages for the web service.
If you are using SAAJ, have you considered or tried to use the SOAPMessage.createAttachmentPart method that takes a DataHandler as parameter?
The DataHandler, in turn, is created with a DataSource as parameter and the DataSource instance is a FileDataSource.
Best wishes!
Charles Ben
Greenhorn

Joined: Jun 02, 2009
Posts: 8
Im using axis to generate the webservice stubs and the files which are uploaded are created run time.
calls to the webservice will look like


Any sample code to prevent this error?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Axis Base64.encode Out of Memory Error.