org.xmlpull.v1.XmlPullParserException出现错误:未终止的实体引用(java.io.InputStreamReader@a4cc4c8中的位置:TEXT @ 1:683533)

时间:2019-01-10 06:57:56

标签: exception android-ksoap2 socket-timeout-exception

我收到未确定实体参考的错误。仅与奥利奥版本。它可以在其他版本上完美工作。我正在使用kso​​ap2 3.1.1版本。而且这个错误并非每次都出现。有时它运行得很好。我注意到一件事,如果我的json响应太大我得到这个例外。请有人可以帮助我吗?  我在httpTransport.call(SOAP_ACTION,信封)处得到异常; 这是我的代码。

@Override
        protected String doInBackground(Void... params) {
            try {
                Log.d("response","5");
                SOAP_ACTION = getString(R.string.WSDL_TARGET_NAMESPACE)+OPERTATION_NAME;
                Log.d("response",SOAP_ACTION);
                SoapObject request = new SoapObject(getString(R.string.WSDL_TARGET_NAMESPACE),OPERTATION_NAME);
                Log.d("response",OPERTATION_NAME);
                Log.d("response",getString(R.string.WSDL_TARGET_NAMESPACE));
                String user = sharedpreference.getvalue("user",Dashboard_Distributer.this);

                ArrayList<param> pi=new ArrayList<>();
                pi.add(new param("utype", "Distributer"));

                for(int i=0;i<pi.size();i++) {
                    request.addProperty(pi.get(i).getName(), pi.get(i).getValue());
                }




                Log.d("response",request.toString());
                SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                        SoapEnvelope.VER11);
                envelope.dotNet = true;

                envelope.setOutputSoapObject(request);

                HttpTransportSE httpTransport = new HttpTransportSE(getString(R.string.SOAP_ADDRESS),6000000);

                Log.d("response",getString(R.string.SOAP_ADDRESS));
                Object response=null;
                try {
                    Log.d("response","6");
                    //  httpTransport.setTimeout(9000);

                    httpTransport.call(SOAP_ACTION, envelope);
                    response = envelope.getResponse();

                } catch (Exception exception) {
                    exception.printStackTrace();
                    Log.d("response","7");
                    response=exception.toString();
                }
                Log.d("response","8");
                return response.toString();
            } catch (Exception e) {
                e.printStackTrace();
                Log.d("response","9");
                resp = e.getMessage();
            }
            return resp;
        }

        @Override
        protected void onPostExecute(String result) {
            // execution of result of Long time consuming operation
            String response=result;

            try {
                JSONObject jsonObj = new JSONObject(response);

                JSONArray jsonArray = jsonObj.getJSONArray("data");



                article_models=new ArrayList<>();

                for(int i=0;i<jsonArray.length();i++)
                {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    Article_Model article_model = new Article_Model(jsonObject.getString("ItemCode"), jsonObject.getString("U_Mould"), jsonObject.getString("U_Color"),
                            jsonObject.getString("ColorName"), jsonObject.getString("U_MRP"), jsonObject.getString("U_Category"), jsonObject.getString("U_Image"),jsonObject.getString("type"));

                    article_models.add(article_model);
                }

                    manageDatabase.deleteArticle();
                    manageDatabase.addArticles(article_models);

                retailer_models=new ArrayList<>();
                ArrayList<param> pi2 = new ArrayList<>();
                pi2.add(new param("distributor_id", sharedpreference.getvalue("user_id", getApplicationContext())));


                CallSoap callSoap2 = new CallSoap(Dashboard_Distributer.this, pi2, OPERTATION_NAME2, true);
                String response2 = callSoap2.Call();
                Log.d("response", response2);

                JSONObject jsonObj2 = new JSONObject(response2);
                JSONArray jsonArray2 = jsonObj2.getJSONArray("data");
                for (int i = 0; i < jsonArray2.length(); i++) {
                    JSONObject jsonObject = jsonArray2.getJSONObject(i);
                    Retailer_Model distributor_model = new Retailer_Model(jsonObject.getString("retailer_id"), jsonObject.getString("retailer_name"),jsonObject.getString("distributer_id"));

                    retailer_models.add(distributor_model);

                }

                manageDatabase.deleteRetailer();
                manageDatabase.addRetailars(retailer_models);

                } catch (JSONException e) {
                    e.printStackTrace();
                }
                progressDialog.dismiss();

            // finalResult.setText(result);
        }


    }

0 个答案:

没有答案