axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Linus Kamb <li...@iris.washington.edu>
Subject only 1 of multiple attachments showing up
Date Wed, 01 Jun 2005 16:00:32 GMT
I have a web service that is to return binary data as attachments.

Using Doc/Lit/wrapped.

The interface looks like

DataHandler[] getWaveformAttach(WaveformAttachQuery qry);

The server appears to be properly packaging up the multiple attachments and returning 
them.  On the client side, the DataHandler[] array is always of length 1.  However, if I 
get the Attachments iterator using

locator.getCall().getResponseMessage().getAttachments(),

and iterate through the list, all of the attachments are there.  I can also see that the 
attachments have come across as they exist as temp files in the system temp dir. (Another

side question on this below.)

So my question is, why is the DataHandler[] array always of length 1?  Do I *have to* 
access the attachments through the iterator?  Am I doing something else wrong?

The java code (with the return type of DataHandler[]) was generated using WSDL2Java.

Using 1.2RC3 (also happened RC2).

Attached is the WSDL and deploy doc.


My aside question is:  Why are the temp files being written to the temp dir?  Following 
the code/advice in the FAQ, I wouldn't think that would happen.  I do the following:

             Iterator iterator = locator.getCall().getResponseMessage().getAttachments();
             int i = 0;
             while ( iterator.hasNext() )
             {
                 AttachmentPart part     = (AttachmentPart) iterator.next();
                 DataHandler    handler  = part.getDataHandler();
                 handler.writeTo(new FileOutputStream(selectedDir.getCanonicalPath() +
                                                      File.separator +
                                                      fileNameString( qry[i++] )));
             }

which *does* write the files to the appropriate dir, but they are *also* written to the 
temp dir.

Sure, I could do File.renameTo() but that may involve copying, depending on the file 
structure.  I vaguely recall from when I last used Axis a couple years ago that I could 
set the directory where Axis would put the files, but I could not find anything in 
searching the list or googling, and I could just plain be mis-remembering.


Thanks for any insight,

Linus



Mime
View raw message