androidmagentoksoap2magento-soap-api

SoapFault - faultcode: SOAP-ENV:Server faultstring: Allowed memory size of 134217728 bytes exhausted (tried to allocate 9758721 bytes)


I am making an application in Android which uses Magento SOAP web services using ksoap2 library as below

@Override
    protected Void doInBackground(Void... arg0) {
        try {
            SoapObject request = new SoapObject("urn:Magento", "catalogProductList");
            request.addProperty("sessionId",sessionId );
            env.setOutputSoapObject(request);
            androidHttpTransport.call("", env); //EXCEPTION THROWN HERE
            SoapObject soapResponse = (SoapObject) env.getResponse();
            Log.d("catalog Product List".toUpperCase(), soapResponse.toString());

In the above code I am calling catalogProductList SOAP API method which has been overridden on the server to include more fields in the response other than standard fields (more fields like product description & all) to create a database in SQLite in Android

I am getting following exception at the line pointed out above:

02-18 16:07:24.134: W/System.err(14614): SoapFault - faultcode: 'SOAP-ENV:Server' faultstring: 'Allowed memory size of 134217728 bytes exhausted (tried to allocate 9758721 bytes)' faultactor: 'null' detail: null
02-18 16:07:24.204: W/System.err(14614):    at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:137)
02-18 16:07:24.204: W/System.err(14614):    at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:140)
02-18 16:07:24.204: W/System.err(14614):    at org.ksoap2.transport.Transport.parseResponse(Transport.java:129)
02-18 16:07:24.204: W/System.err(14614):    at org.ksoap2.transport.HttpTransportSE.parseResponse(HttpTransportSE.java:301)
02-18 16:07:24.204: W/System.err(14614):    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:274)
02-18 16:07:24.204: W/System.err(14614):    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118)
02-18 16:07:24.204: W/System.err(14614):    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113)
02-18 16:07:24.204: W/System.err(14614):    at in.myproject.MainActivity$LoadDatabase.doInBackground(MainActivity.java:680)
02-18 16:07:24.204: W/System.err(14614):    at in.myproject.MainActivity$LoadDatabase.doInBackground(MainActivity.java:1)
02-18 16:07:24.204: W/System.err(14614):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-18 16:07:24.204: W/System.err(14614):    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-18 16:07:24.204: W/System.err(14614):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
02-18 16:07:24.204: W/System.err(14614):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-18 16:07:24.204: W/System.err(14614):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-18 16:07:24.204: W/System.err(14614):    at java.lang.Thread.run(Thread.java:856)

Can someone help me in solving this error & getting product list.

NOTE: I can see the response of the above SOAP API method in PHP, but when I call this on Android I get the above mentioned error.


Solution

  • The error is coming from the Magento server. It is running out of memory trying to load a large collection. You have a few options:

    1. Increase the memory limit on the server, or
    2. Limit your collection