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
Code:
<xs:element name="GetDocRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="docIdInput" type="types:GetDocInput" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="GetDocInput">
<xs:sequence>
<xs:element name="documentId" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="GetDocsResponse">
<xs:complexType>
<xs:sequence>
<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>
</xs:element>
<xs:complexType name="DocumentInfo">
<xs:sequence>
<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"/>
</xs:sequence>
</xs:complexType>
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
Code:
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?