0

i am trying to get information on server using ksoap2, but got an error, i tried many ways but still can't fix it, below is my source code i try to connect to webservice, but i have a error, it is "Cleartext HTTP traffic to 192.168.1.9 not permitted". how to i can fix it

class contactTask extends AsyncTask<Integer,Void, Contact>{
            class contactTask extends AsyncTask<Integer,Void, Contact>{
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            txtMa.setText("");
            txtTen.setText("");
            txtPhone.setText("");
            progressDialog.show();
        }

        @Override
        protected void onPostExecute(Contact contact) {
            super.onPostExecute(contact);
            txtMa.setText(contact.getMa()+"");
            txtTen.setText(contact.getTen());
            txtPhone.setText(contact.getPhone());
            progressDialog.dismiss();
        }

        @Override
        protected void onProgressUpdate(Void... values) {
            super.onProgressUpdate(values);
        }

        @Override
        protected Contact doInBackground(Integer... integers) {
            try {
                int ma = integers[0];
                SoapObject request = new SoapObject(Configuration.NAME_SACPE,Configuration.METHOS_GET_DETAIL);
                request.addProperty(Configuration.PARAM_DEATAIL_MA,ma);

                SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                envelope.dotNet=true;
                envelope.setOutputSoapObject(request);

                HttpTransportSE httpTransportSE = new HttpTransportSE(Configuration.SERVER_URL);
                httpTransportSE.call(Configuration.SOAP_DETAIL_MA,envelope);

                SoapObject data = (SoapObject) envelope.getResponse();
                Contact contact = new Contact();

                if(data.hasProperty("Ma")){
                    contact.setMa(Integer.parseInt(data.getPropertyAsString("Ma")));
                }
                if(data.hasProperty("Ten")){
                    contact.setTen(data.getPropertyAsString("Ten"));
                }
                if(data.hasProperty("Phone")){
                    contact.setPhone(data.getPropertyAsString("Phone"));
                }

                return contact;
            }
            catch (Exception ex){
                Log.e("Error: ",ex.toString());
            }
            return null;
        }
    }

error message

2021-08-28 15:33:31.997 16318-16384/com.example.laythongtintusoapobject E/libc: Access denied finding property "persist.vendor.log.tel_dbg"
2021-08-28 15:33:32.001 16318-16384/com.example.laythongtintusoapobject D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2021-08-28 15:33:32.005 16318-16384/com.example.laythongtintusoapobject E/Error:: java.io.IOException: Cleartext HTTP traffic to 192.168.1.9 not permitted
ninh312
  • 1
  • 2
  • Assuming that this is running on Android, did you [look at the answer on this very similar question](https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted) before? – ToJa92 Aug 28 '21 at 10:18
  • Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – Community Aug 30 '21 at 13:59

0 Answers0