title: Very large SOAP response - Android- out of memory error
body: <p>I have an application where i need to download a large amount of data via a SOAP call to a webservice into the application when it is first run. The response is then sent to a function which converts the XML and stores the data in a db file.</p>
  
  <p>The data is more than 16MB in size and i have a java.lang.OutOfMemoryError everytime.</p>
  
  <p>Modifying the webservice to give out smaller amounts of data is not an option.</p>
  
  <p>Is there a way to be able to download the large data? Something like an InputStream perhaps?</p>
  
  <p>This is my code</p>
  
  <pre><code>public Protocol[] getProtocols() {
  
      String METHOD_NAME = "GetProtocols";
      String SOAP_ACTION = "urn:protocolpedia#GetProtocols";
      Log.d("service", "getProtocols");
      SoapObject response = invokeMethod(METHOD_NAME, SOAP_ACTION);
      return retrieveProtocolsFromSoap(response);
  }
  
  private SoapObject invokeMethod(String methodName, String soapAction) {
      Log.d(TAG, "invokeMethod");
      SoapObject request = GetSoapObject(methodName);
      SoapSerializationEnvelope envelope = getEnvelope(request);
      return makeCall(envelope, methodName, soapAction);
  
  }
  </code></pre>
  
  <p>Can anyone suggest what should be done in this case?</p>
  
  <p>Thanks and regards
  Mukul</p>