I am developing an application that need a certificate verification from the server. It works fine on Android 2<http://boardreader.com/tp/Android%202.html>.2 version and above, but for android 2.1 it gave me an exception javax.net.ssl.SSLException: Not trusted server certificate. can any one please help me.
Here is my code: String URL ="https://mywolla.com/mobwebservices/svalidateuser.php?wsdl"; final String SOAP_ACTION = "urn:server#validateUser"; final String METHOD_NAME = "validateUser"; final String NAMESPACE = "http://tempuri.org/"; SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("username", _username.getText().toString() .trim()); request.addProperty("password", _password.getText().toString() .trim()); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); envelope.dotNet = false; // envelope.setOutputSoapObject(request); envelope.bodyOut = request; HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { androidHttpTransport.call(SOAP_ACTION, envelope); } catch (XmlPullParserException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println(_password.getText().toString().trim() + "-----_username.getText().toString().trim()--->" + _username.getText().toString().trim()); Object result = envelope.bodyIn; System.out.println("....login responce....." + result); response = result.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); // errorMsg.setText(e.getMessage()); } catch (KeyException e) { e.printStackTrace(); // errorMsg.setText(e.getMessage()); } catch (ClassCastException e) { e.printStackTrace(); // errorMsg.setText(e.getMessage()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); return e.getMessage(); } return response; } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en