获取java.lang.RuntimeException:在使用kso​​ap2在android中将字节数组列表传递给Web服务时,使用overflowserialize

时间:2013-02-12 07:16:23

标签: android ksoap2 android-ksoap2

我的db文件大小约为5 mb,我已经转换为字节数组列表,并希望将其传递给我的Web服务以便在服务器上保存,但我得到的是无法序列化错误。我在下面附上我的代码......

            SoapObject soap_request = new SoapObject(NAMESPACE, METHOD_NAME1);
            fileName = "DB"+UserID+"_"+backupDateTime+".db";

            PropertyInfo pi1 = new PropertyInfo();
            pi1.setName("_FileName");
            pi1.setType(String.class);
            pi1.setValue(fileName);
            soap_request.addProperty(pi1);

            PropertyInfo pi2 = new PropertyInfo();
            pi2.setName("_ByteArray");
            pi2.setType(ArrayList.class);
            pi2.setValue(data);
            soap_request.addProperty(pi2);

            PropertyInfo pi3 = new PropertyInfo();
            pi3.setName("UserID");
            pi3.setType(Integer.class);
            pi3.setValue(UserID);
            soap_request.addProperty(pi3);

            Log.v(TAG, "soap_request _FileName= >>"+soap_request.getProperty(0));
            Log.v(TAG, "soap_request _ByteArray= >>"+soap_request.getProperty(1));
            Log.v(TAG, "soap_request UserID= >>"+soap_request.getProperty(2));

            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            //new MarshalBase64().register(envelope);
            envelope.setOutputSoapObject(soap_request);
            envelope.dotNet = true;

            Log.v(TAG,"Calling webservice....");
            androidHttpTransportSE = new HttpTransportSE(URL);
            androidHttpTransportSE.debug = true;
            androidHttpTransportSE.call(SOAP_ACTION1, envelope);

            Log.v(TAG,"Getting result from webservice....");
            SoapObject result = (SoapObject) envelope.bodyIn;
            JSONObject response = new JSONObject(result.getProperty(0).toString());
            Log.v(TAG, "Web Response...." + response.get(" Result "));

            if (response.get(" Result ").equals("Uploading DataBase Backup To Server successfully"))
            {
                flag = true;
                Log.v(TAG, "Database is uploaded .........");
            }

1 个答案:

答案 0 :(得分:0)

尝试更改此

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
//new MarshalBase64().register(envelope);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
new MarshalBase64().register(envelope); // this line is for serialization

此外,您可以通过此Link来了解您的问题。

希望它会对你有所帮助。