Each android version has a list of Root certificate authorities it 
supports, the specific certificate your server uses is signed by an entity 
unknown by android 2.1.

You can either supply that server certificate within your application or 
change the server certificate to one recognized by android 2.1

On Monday, September 24, 2012 8:51:36 AM UTC+2, aravelli wrote:
>
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to