SoapFault - faultcode:SOAP-ENV:服务器faultstring:允许的内存大小为134217728字节耗尽(试图分配9758721字节)

时间:2015-02-18 13:07:27

标签: android magento soap ksoap2

我在Android中创建一个使用Magento SOAP Web服务的应用程序,使用kso​​ap2库,如下所示

@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());

在上面的代码中,我调用catalogProductList SOAP API方法,该方法已在服务器上重写,以在响应中包含除标准字段之外的更多字段(更多字段,如产品描述和所有)以创建数据库在Android中的SQLite

我在上面指出的那一行得到以下异常:

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)

有人可以帮我解决这个错误吗?获得产品清单。

注意:我可以在PHP中看到上述SOAP API方法的响应,但是当我在Android上调用它时,我得到了上面提到的错误。

1 个答案:

答案 0 :(得分:0)

错误来自Magento服务器。尝试加载大型集合时内存不足。您有几个选择:

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