Hello friends
 i have a php webservice which checks with database for the username
and password provided.
when i run the following code i get 09-13 15:42:28.354: WARN/
System.err(593): javax.net.ssl.SSLPeerUnverifiedException: No peer
certificate
..

and my line
HttpResponse res = cl.execute(post);

will not get executed..

i m confused.. i have the following https url...


Thanks in advance

my code is *************



package com.example;

import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class LoginDemoActivity extends Activity {

        EditText edtusername, edtpassword;
        Button btnsignin;

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.login);

                edtusername = (EditText) findViewById(R.id.username);
                edtpassword = (EditText) findViewById(R.id.password);
                btnsignin = (Button) findViewById(R.id.btnsignin);

                btnsignin.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                                Log.i("the username is" + 
edtusername.getText().toString(),
                                                "the password is" + 
edtpassword.getText().toString());
                                Log.i("before arraylist ***", "2222222");

                                ArrayList<NameValuePair> postParameters = new
ArrayList<NameValuePair>();
                                postParameters.add(new 
BasicNameValuePair("username",
                                                
edtusername.getText().toString()));
                                postParameters.add(new 
BasicNameValuePair("password",
                                                
edtpassword.getText().toString()));

                                Log.i("before socket is registered ***", 
"33333333");

                                SchemeRegistry schemeRegistry = new 
SchemeRegistry();
                                //schemeRegistry.register(new Scheme("http",
PlainSocketFactory.getSocketFactory(), 80));
                                schemeRegistry.register(new Scheme("https",
SSLSocketFactory.getSocketFactory(), 443));

                                Log.i("after socket is registered ***", 
"44444");
                                String url = "https://192.18.10
106/check_admin.php?method=check_admin";
                                HttpPost post = new HttpPost(url);
                                HttpClient cl = new DefaultHttpClient();

                                UrlEncodedFormEntity ent = null;
                                try {
                                        ent = new 
UrlEncodedFormEntity(postParameters, HTTP.UTF_8);
                                } catch (UnsupportedEncodingException e1) {
                                        // TODO Auto-generated catch block
                                        e1.printStackTrace();
                                }
                                post.setEntity(ent);
                                try {


                                        HttpResponse res = cl.execute(post);
                                        InputStream in = 
res.getEntity().getContent();

                                        byte[] bytes = new byte[in.available()];
                                        in.read(bytes);
                                        String s = new String(bytes);

                                        Log.i("the string value is", "***" + s);

                                } catch (ClientProtocolException e) {
                                        // TODO Auto-generated catch block
                                        e.printStackTrace();
                                } catch (IOException e) {
                                        // TODO Auto-generated catch block
                                        e.printStackTrace();
                                }

                        }
                });

        }

}

-- 
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