Hi Axis2 users:

   I am accessing a service that provides the response with an MTOM
attachment. (The attachment can be just hundreds of  KB up to 75 MB).
   I am using an Axis2 v 1.5.1 client.
   My client code looks something like:


            MyServiceResponse myServiceResponse=service.downloadTable(tableid
);
            DataHandler dataHandler = myServiceResponse.getTableFile();
            is = new GZIPInputStream(  new BufferedInputStream(
dataHandler.getInputStream() ) );
            BufferedReader br = new BufferedReader( new InputStreamReader(
is, "UTF-8") );
            int members =0;
            for(String line = br.readLine(); line != null; line =
br.readLine() ) {
                 // do something with the record here ...
                  System.out.println(line);
            }

where "service" is the generated stub using ADB databinding.

    wsdl2java -o myoutputpath -d adb -u -uw -ap -or  -uri
http://url/to/my/service.wsdl

The The attachment is a tab-separated text file that has been gzipped.
The file is produced "on-the-fly" from a database, there is never a physical
file.
The server uses SpringWS with JAXB as the marshaller/unmarshaller with mtom
enabled.
But I believe these details are irrelevant.

I was expecting that the call to service.downloadTable(tableid) would return
almost immediately and that the file would be streamed, resulting on
execution of the loop in parallel as the server provides the file.
But what I am observing is that my server streams the whole file (table) and
just after all the data was sent (according to server logs) then  the call
to downloadTable(tableid) returns and the loop starts executing.

Is the client caching the attachment prior to return from
service.downloadTable(tableid) ? I noticed the memory used by the JVM
increases, but that does not prove anything)

Is there a way to make the call such as the loop will start executing as the
file is streamed ?

-Jorge

Reply via email to