Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I can't comment yet so i post my comments to rallat answer here. His solution works but it needs further explanations. To run ksoap2 with ssl: </p> <ol> <li>Put <code>ksoap2-android-assembly-2.5.2-jar-with-dependencies.jar</code> in a project</li> <li>Download ksoap2 sources from <a href="https://github.com/mosabua/ksoap2-android/tree/">https://github.com/mosabua/ksoap2-android/tree/</a> (ksoap2 repository) </li> <li>Copy <code>HttpTransportSE.java</code>, <code>ServiceConnectionSE.java</code> (I also needed to copy <code>Transport.java</code>, <code>ServiceConnection.java</code> and <code>HeaderProperty.java</code>). Delete imports from those files and make sure that they use your files (not imports from <code>ksoap2.jar</code>)</li> <li><p>Use rallat answer ( I copy-pasted it): </p> <ul> <li><p><code>ServiceConnectionSE.java</code> add this for accept untrusted certificate:</p> <pre><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) { } } }; </code></pre></li> <li><p>then use this constructors to allow untrusted certificates and not verified hostnames:</p> <pre><code>public ServiceConnectionSE(String url) throws IOException { try { SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } catch (Exception e) { e.getMessage(); } connection = (HttpsURLConnection) new URL(url).openConnection(); ((HttpsURLConnection) connection).setHostnameVerifier(new AllowAllHostnameVerifier()); } </code></pre></li> <li><p>Second contructor</p> <pre><code>public ServiceConnectionSE(Proxy proxy, String url) throws IOException { try { SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } catch (Exception e) { e.getMessage(); } connection = (HttpsURLConnection) new URL(url).openConnection(); ((HttpsURLConnection) connection).setHostnameVerifier(new AllowAllHostnameVerifier()); connection.setUseCaches(false); connection.setDoOutput(true); connection.setDoInput(true); } </code></pre></li> </ul></li> <li><p>In your code just use: </p> <pre><code>HttpTransportSE aht = new HttpTransportSE(URL); aht.call(SOAP_ACTION, envelope); </code></pre></li> </ol> <p>Other things as in tutorials</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload