and just in case someone asks, this is what the server is sending, followed
by the attachment (that I omitted)

<?xml version="1.0" encoding="utf-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/
">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <ns10:downloadTableResponse  xmlns:ns10="uri:
audiencetransfer.ws.sdk.example.com">
            <ns10:tableId>137778386</ns10:tableId>
            <ns10:tableFile>
                <xop:Include xmlns:xop="
http://www.w3.org/2004/08/xop/include";
href="cid:2b2ed5e7-54cc-4dd4-a6f7-209a5e158915%40null"/>
            </ns10:tableFile>
        </ns10:downloadTableResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


On Mon, Jun 7, 2010 at 6:16 PM, Jorge Medina
<[email protected]>wrote:

> Also, I want to make a recommendation to the users of my service.
> Although they may use any SOAP client, I provide them with a pre-compiled
> client using Axis2 v1.5.1 (yeah, I know, they could generate their own)
> I want to give some advise on how to use the service when using Axis2.
> If the client caches all the attachments in memory, I need to tell them to
> be aware of their memory requirements.
>
> On Mon, Jun 7, 2010 at 5:58 PM, Jorge Medina <[email protected]
> > wrote:
>
>> 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