This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Web Services and the fly likes Attachments with Axis Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Attachments with Axis" Watch "Attachments with Axis" New topic

Attachments with Axis

Dan Miller

Joined: Nov 19, 2008
Posts: 3

I'm somewhat of a Web Services newbie. I am trying to modify an existing web service that FTPs a CSV file from a legacy system, reads through it, and writes some XML out to the web service. It is pretty top-down in that (for the most part) it reads a line of CSV, writes out a chunk of XML, rinse, repeat.

We are using Apache Axis 1.4 and what appears to happen is that Axis / Apache builds the whole String in memory before writing out the response.

Because the files we are sending are quite large, we occasionally run out of memory while processing them. As part of the rewrite of the service, I'm being asked to rewrite the service so that it takes up less memory.

In doing a bit of reading around I have come across the concept that for large files, the best practice is to use SAAJ / attachments.

I was wondering if anyone had any pointers to some good introductory lessons on that? I've read

but most of the examples I see there have explicit SoapMessage and AttachmentPart objects in the code - all the code I am trying to re-use has all of that abstracted by Axis.

Thanks for reading and feel free to ask clarifying questions. I'll be the first to admit I only have a rudimentary grasp of this.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1183

An identical question and a similar one in this forum.


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Dan Miller

Joined: Nov 19, 2008
Posts: 3

Thanks for taking the time to reply.

Now, I may be misreading the links that you sent (such are the downsides of not totally understanding the basic framework), but both of those links seem to talk about how to READ attachments when consuming a web service.

I am trying to PROVIDE attachments as part of the service.
I agree. Here's the link:
subject: Attachments with Axis
It's not a secret anymore!