2

I'm using KSOAP2 to call to a web service. At first, I tried to work it without any kind of security (only HTTP) and the result was a success. Now I've added SSL security to my Web Service (it runs on an Apache Axis2), but I can't connect from my Android app by using KSOAP2. I've been searching around and the only answers I can get are the ones who tell me that I should trust all untrusted certificates (create a fake trustmanager):

Not trusted certificate using ksoap2-android

KSOAP 2 Android with HTTPS

And they paste always the same code:

private TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
    public java.security.cert.X509Certificate[] getAcceptedIssuers() {
        return null;
    }
    public void checkClientTrusted(
        java.security.cert.X509Certificate[] certs, String authType) {
    }
    public void checkServerTrusted(
        java.security.cert.X509Certificate[] certs, String authType) {
    }
}
};

Which is not what I'm looking for. This answer, even if it works, it's just only a workaround and doesn't solve the problem, just avoids it. What I want to know is if there is a way where you can modify the Android cacerts and add my untrusted certificate or just do something in order to avoid the solution I've just talked about. I don't want to create a new trustmanager if it could be possible.

Community
  • 1
  • 1
PhilipJFry87
  • 73
  • 1
  • 6

1 Answers1

0

If you are working with the Emulator don't use 10.0.2.2 for the server ip. For me it was not working.

Try to test your app on physical device (through Wifi)

naveejr
  • 735
  • 1
  • 15
  • 31