call https soap service in android

118 Views Asked by At

I am trying to call a soap services from android project I have used ksoap2 in order to do that using the code below

public int timeOut = 30000;
public String response;
@Override
protected void onPreExecute() {
        super.onPreExecute();
        }

@Override
protected void onPostExecute(String s) {

        super.onPostExecute(s);
//        MainActivity.getInstance().handleResponse(response);
        }

@Override
protected String doInBackground(String... strings) {
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        SoapSerializationEnvelope soapSerializationEnvelop = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        soapSerializationEnvelop.dotNet= true;
        soapSerializationEnvelop.setOutputSoapObject(request);

        HttpsTransportSE transportSE = new HttpsTransportSE(url,433,null,timeOut);  //(url,timeOut);
        try{
        transportSE.call(SOAP_ACTION ,soapSerializationEnvelop );
        response = soapSerializationEnvelop.getResponse().toString();
        Log.d("response", response);

        }catch(Exception e){
           Log.d("ErrorInSoapUI", e.toString());
          // Toast.makeText(e.getMessage()).show();
        }

//             = response;


        return response;
        }

the code was working when the url was : http but now my service exist with the prifix: https I have done some searchng to do that but nothing comes up working I am facing this error

javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

any suggestions... thanks in advance.

1

There are 1 best solutions below

1
Tamim Zawahiri On

make sure the date and time are correct in your device.