salut,,


je suis entrain de faire module authentification avec android

je travail avec sdk 4.0.3 et mysql

pour accéder au base de donnée mysql j'utilise web service


la table user contient deux attributs : login,mail

et j'ai comme valeur : test,test

le code que j'utilise est :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.android.gd;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
 
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
 
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
 
public class ProjectGDActivity extends Activity {
	//private TextView textView;
	private String METHOD_NAME ="authentification"; // our webservice method name
	private String NAMESPACE ="http://gd.com"; // Here package name in
													// webservice with reverse
													// order.
	private String SOAP_ACTION = NAMESPACE + METHOD_NAME; // NAMESPACE + method
															// name
	private static final String URL ="http://192.168.1.98:8082/wsgd/services/gd?wsdl"; // you
	TextView tv;
	TextView tv2;
 
/** Called when the activity is first created. */
 
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
 
		TaskWs task = new TaskWs();
		task.execute();
		}
 
	private class TaskWs extends AsyncTask<String, Void, String> {
 
		@Override
		protected void onPostExecute(String result) {
			tv.setText(result);
		}
 
		@Override
		protected String doInBackground(String... params) {
			String v="addi";
		Object result = v ;
 
			 tv = (TextView) findViewById(R.id.Ch_Login);
			 tv2 = (TextView) findViewById(R.id.Ch_Passwd );
 
			try {
				SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
				request.addProperty("login", "test");
				request.addProperty("mail", "test");
				SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
						SoapEnvelope.VER11);
				envelope.dotNet = true;
				envelope.setOutputSoapObject(request);
 
				HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
				androidHttpTransport.call(SOAP_ACTION,envelope);
				 result = envelope.getResponse();
 
				//((TextView) findViewById (R.id.txtAddition)).setText("Addition : "+result.toString());
 
			} catch (Exception E) {
				E.printStackTrace();
			//((TextView) findViewById (R.id.txtAddition)).setText("ERROR:"    + E.getClass().getName() + ":" + E.getMessage());
				}
			// TODO Auto-generated method stub
			return result.toString();
		}
 
 
	}
 
	public void readWebpage(View view) {
 
 
	}
}



et j'ai dans le projet web qui contient le web service cette methode "authentification"

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public  boolean authentification(String login,String mail){
		UsersHome u=new UsersHome();
		UsersId us=new UsersId(login, mail);
	List<Users>	listu=u.findByCriteria(us);
	if(listu.size()>0){
		System.err.println("succes");	
 
		return true;
	}
		else{
			System.err.println("echec");	
			return false;
 
		}
 
 
	}
mais je trouve des problème avec cet exemple puisque il se plante dans l'interface d'authentification

merci d'avance