HttpsURLConnection httpsConn = (HttpsURLConnection) androidHttpTransport.getServiceConnection();
httpsConn.setSSLSocketFactory( /*SET SSL SOCKET FACTORY HERE*/);
--
You received this message because you are subscribed to the Google Groups "ksoap2-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ksoap2-androi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
SSLContext context = SSLContext.getInstance("TLSv1.2");context.init(null, null, null);tls12Factory = context.getSocketFactory();
private Tls12OnlySocket(SSLSocket delegate) { super(delegate); delegate.setEnabledProtocols(new String[]{"TLSv1.2"});}
@Overridepublic void setEnabledProtocols(String[] protocols) {}
@Override public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException { return strippedProtocolSocket(delegate.createSocket(s, host, port, autoClose)); }
private Socket strippedProtocolSocket(Socket socket) { if (socket instanceof SSLSocket) { socket = new Tls12OnlySocket((SSLSocket) socket); } return socket; }
public class HttpsTls12TransportSE extends HttpsTransportSE{ public HttpsTls12TransportSE(String host, int port, String file, int timeout) { super(host, port, file, timeout); } @Override public ServiceConnection getServiceConnection() throws IOException { ServiceConnection serviceConnection = new HttpsServiceConnectionSEIgnoringConnectionClose(host, port, file, timeout); serviceConnection.setRequestProperty("Connection", "keep-alive");
SSLSocketFactory factory = new Tls12SocketFactory(); ((HttpsServiceConnectionSE)serviceConnection).setSSLSocketFactory(factory);
return serviceConnection; }
}
Follow up question, do i still need to configure the webconfig of webservice because we are trying to call the web method it returns an error. Please see below. I am now using the WCf webservice. Im confused where is the cause of an error. We successfully applied the what was you've given to us. THANKS IN ADVANCE. :)
ERROR FROM APP:
10-24 13:24:32.255: W/System.err(32367): java.net.SocketTimeoutException: Read timed out
10-24 13:24:32.315: W/System.err(32367): at com.android.org.conscrypt.NativeCrypto.SSL_read(Native Method)
10-24 13:24:32.315: W/System.err(32367): at com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:690)
10-24 13:24:32.315: W/System.err(32367): at java.io.InputStream.read(InputStream.java:162)
10-24 13:24:32.315: W/System.err(32367): at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)
10-24 13:24:32.315: W/System.err(32367): at java.io.BufferedInputStream.read(BufferedInputStream.java:227)
10-24 13:24:32.315: W/System.err(32367): at com.android.okhttp.internal.Util.readAsciiLine(Util.java:316)
10-24 13:24:32.315: W/System.err(32367): at com.android.okhttp.internal.http.RawHeaders.fromBytes(RawHeaders.java:308)
10-24 13:24:32.315: W/System.err(32367): at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:135)
10-24 13:24:32.315: W/System.err(32367): at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:644)
10-24 13:24:32.315: W/System.err(32367): at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:347)
10-24 13:24:32.315: W/System.err(32367): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)
10-24 13:24:32.315: W/System.err(32367): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:503)
10-24 13:24:32.315: W/System.err(32367): at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:136)
10-24 13:24:32.315: W/System.err(32367): at org.ksoap2.transport.HttpsServiceConnectionSE.getResponseCode(HttpsServiceConnectionSE.java:107)
10-24 13:24:32.325: W/System.err(32367): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:192)
10-24 13:24:32.325: W/System.err(32367): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118)
10-24 13:24:32.325: W/System.err(32367): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113)
10-24 13:24:32.325: W/System.err(32367): at com.smart.paymaya.CallSoapActivate.doInBackground(CallSoapActivate.java:164)
10-24 13:24:32.325: W/System.err(32367): at com.smart.paymaya.CallSoapActivate.doInBackground(CallSoapActivate.java:1)
10-24 13:24:32.335: W/System.err(32367): at android.os.AsyncTask$2.call(AsyncTask.java:288)
10-24 13:24:32.335: W/System.err(32367): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-24 13:24:32.335: W/System.err(32367): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
10-24 13:24:32.335: W/System.err(32367): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
10-24 13:24:32.335: W/System.err(32367): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
10-24 13:24:32.335: W/System.err(32367): at java.lang.Thread.run(Thread.java:841)