Announcement Announcement Module
No announcement yet.
Spring-WS client Out of Memory on recieving multiple large files Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring-WS client Out of Memory on recieving multiple large files

    I have a Spring-WS which takes a lit of documents Ids as input, fetched list of document/image/video files from database and returns as base64encoded data. I am using Jaxb2 marshaller.
    My xsd
    <xs:element name="GetDocRequest">
                    <xs:element name="docIdInput" type="types:GetDocInput" minOccurs="0" maxOccurs="unbounded"/>
        <xs:complexType name="GetDocInput">
                    <xs:element name="documentId" type="xs:string"/>
        <xs:element name="GetDocsResponse">
                    <xs:element name="docData" type="types:DocumentInfo" minOccurs="0" maxOccurs="unbounded"/>
                   <!--  <xs:element name="imageData" type="types:ImageInfo" minOccurs="0" maxOccurs="unbounded"/>
                --> </xs:sequence>
        <xs:complexType name="DocumentInfo">
       				 <xs:element name="Id" type="xs:string"/>
                    <xs:element name="Description" type="xs:string"/>
                     <xs:element name="Size" nillable="true" type="xs:int"/>
                      <xs:element name="DocContentType"  nillable="true" type="xs:string"/>
                     <xs:element name="DocumentBody" nillable="true"  type="xs:base64Binary" xmime:expectedContentTypes="application/msword"/>

    The service fetches the data and used DataHandler class with appropriate content type settings.
    Works fine with small files(around 40+) and I am able to write received files to disk from clinet. I tried to send .mov and .mpeg files each having size around 6000KB, then I get Out of Memory error on client.
    Client method
    public void callService() throws IOException {
            Source requestSource = new ResourceSource(request);
            StringResult result = new StringResult();
            webServiceTemplate.sendSourceAndReceiveToResult(requestSource,  result);
             System.out.println("Ended call"+result);
    On server side log, I do not see any errors.
    Is there any limitation on the SOAP attachments size? Or is it due to bandwidth issues?
    I tried using SOAPUI tool to test raw xml, even there, the tool hangs.

    Any pointers?

  • #2
    The problem is that the file is stored in memory. I can successfully receive a 300mb file on the client side by configuring the JVM and disabling logging:

    1. Set the MessageTracing logger log level to a level higher than DEBUG. I was getting out of memory errors when the contents of a large file was being written to the log: Tracing=ERROR

    2. Increase total heap space and eden space. The eden space was key for me: