IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Android Discussion :

page d'authentification avec un webservice


Sujet :

Android

  1. #1
    Membre à l'essai
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2013
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Laos

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Juillet 2013
    Messages : 25
    Points : 23
    Points
    23
    Par défaut page d'authentification avec un webservice
    Bonsoir,
    j'ai essayé ce code pour créer une page d'authentification, or j'obtiens les erreurs suivantes quand je clique sur retrieve.
    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
    10-03 19:52:38.421: D/(2205): HostConnection::get() New Host Connection established 0x2a1a9bb8, tid 2205
    10-03 19:52:41.801: D/dalvikvm(2205): GC_FOR_ALLOC freed 88K, 9% free 2538K/2772K, paused 66ms, total 71ms
    10-03 19:52:41.925: I/dalvikvm-heap(2205): Grow heap (frag case) to 8.732MB for 6410576-byte allocation
    10-03 19:52:42.062: D/dalvikvm(2205): GC_FOR_ALLOC freed 2K, 3% free 8796K/9036K, paused 135ms, total 135ms
    10-03 19:52:42.191: D/dalvikvm(2205): GC_CONCURRENT freed <1K, 3% free 8796K/9036K, paused 11ms+21ms, total 129ms
    10-03 19:52:47.692: E/WebServiceTask(2205): Connect to /192.168.1.9:8080 timed out
    10-03 19:52:47.692: E/WebServiceTask(2205): org.apache.http.conn.ConnectTimeoutException: Connect to /192.168.1.9:8080 timed out
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at com.avilyne.android.AndroidRESTClientActivity$WebServiceTask.doResponse(AndroidRESTClientActivity.java:185)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at com.avilyne.android.AndroidRESTClientActivity$WebServiceTask.doInBackground(AndroidRESTClientActivity.java:141)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at com.avilyne.android.AndroidRESTClientActivity$WebServiceTask.doInBackground(AndroidRESTClientActivity.java:1)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at android.os.AsyncTask$2.call(AsyncTask.java:287)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    10-03 19:52:47.692: E/WebServiceTask(2205): 	at java.lang.Thread.run(Thread.java:856)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): End of input at character 0 of 
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): org.json.JSONException: End of input at character 0 of 
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at org.json.JSONTokener.syntaxError(JSONTokener.java:450)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at org.json.JSONTokener.nextValue(JSONTokener.java:97)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at org.json.JSONObject.<init>(JSONObject.java:154)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at org.json.JSONObject.<init>(JSONObject.java:171)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at com.avilyne.android.AndroidRESTClientActivity.handleResponse(AndroidRESTClientActivity.java:81)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at com.avilyne.android.AndroidRESTClientActivity$WebServiceTask.onPostExecute(AndroidRESTClientActivity.java:158)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at com.avilyne.android.AndroidRESTClientActivity$WebServiceTask.onPostExecute(AndroidRESTClientActivity.java:1)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at android.os.AsyncTask.finish(AsyncTask.java:631)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at android.os.AsyncTask.access$600(AsyncTask.java:177)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at android.os.Handler.dispatchMessage(Handler.java:99)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at android.os.Looper.loop(Looper.java:137)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at android.app.ActivityThread.main(ActivityThread.java:5041)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at java.lang.reflect.Method.invokeNative(Native Method)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at java.lang.reflect.Method.invoke(Method.java:511)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    10-03 19:52:48.031: E/AndroidRESTClientActivity(2205): 	at dalvik.system.NativeStart.main(Native Method)
    alors que le logcat doit afficher : Returning sample person : Simple Person

    voici le code:

    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
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    package com.avilyne.android;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.util.ArrayList;
     
    import org.apache.http.HttpResponse;
    import org.apache.http.NameValuePair;
    import org.apache.http.client.HttpClient;
    import org.apache.http.client.entity.UrlEncodedFormEntity;
    import org.apache.http.client.methods.HttpGet;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.apache.http.message.BasicNameValuePair;
    import org.apache.http.params.BasicHttpParams;
    import org.apache.http.params.HttpConnectionParams;
    import org.apache.http.params.HttpParams;
    import org.json.JSONObject;
     
    import android.app.Activity;
    import android.app.ProgressDialog;
    import android.content.Context;
    import android.os.AsyncTask;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.View;
    import android.view.inputmethod.InputMethodManager;
    import android.widget.EditText;
    import android.widget.Toast;
    public class AndroidRESTClientActivity extends Activity {
    private static final String SERVICE_URL = "http://192.168.1.9:8080/RestWebServiceDemo/rest/person";
    private static final String TAG = "AndroidRESTClientActivity";
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.activity_android_restclient);
    	}
     
    public void retrieveSampleData(View vw) {
    	String sampleURL = SERVICE_URL + "/sample";
    	WebServiceTask wst = new WebServiceTask(WebServiceTask.GET_TASK, this, "GETting data...");
    	wst.execute(new String[] { sampleURL });
    }
    public void clearControls(View vw) {
    	EditText edFirstName = (EditText) findViewById(R.id.firstname);
    	EditText edLastName = (EditText) findViewById(R.id.last_name);
    	EditText edEmail = (EditText) findViewById(R.id.email);
    	edFirstName.setText("");
    	edLastName.setText("");
    	edEmail.setText("");
    }
    public void postData(View vw) {
    	EditText edFirstName = (EditText) findViewById(R.id.firstname);
    	EditText edLastName = (EditText) findViewById(R.id.last_name);
    	EditText edEmail = (EditText) findViewById(R.id.email);
    	String firstName = edFirstName.getText().toString();
    	String lastName = edLastName.getText().toString();
    	String email = edEmail.getText().toString();
    	if (firstName.equals("") || lastName.equals("") || email.equals("")) {
    	Toast.makeText(this, "Please enter in all required fields.",
    	Toast.LENGTH_LONG).show();
    return;
    		}
    	WebServiceTask wst = new WebServiceTask(WebServiceTask.POST_TASK, this, "Posting data...");
    	wst.addNameValuePair("firstName", firstName);
    	wst.addNameValuePair("lastName", lastName);
    	wst.addNameValuePair("email", email);
    	// the passed String is the URL we will POST to
    	wst.execute(new String[] { SERVICE_URL });
    }
    public void handleResponse(String response) {
    EditText edFirstName = (EditText) findViewById(R.id.firstname);
    	EditText edLastName = (EditText) findViewById(R.id.last_name);
    	EditText edEmail = (EditText) findViewById(R.id.email);
    	edFirstName.setText("");
    	edLastName.setText("");
    	edEmail.setText("");
    	try {
    	JSONObject jso = new JSONObject(response);
    	String firstName = jso.getString("firstName");
    	String lastName = jso.getString("lastName");
    	String email = jso.getString("email");
    	edFirstName.setText(firstName);
    	edLastName.setText(lastName);
    	edEmail.setText(email);
    	} catch (Exception e) {
    	Log.e(TAG, e.getLocalizedMessage(), e);
    	}
    }
    private void hideKeyboard() {
    	InputMethodManager inputManager = (InputMethodManager) AndroidRESTClientActivity.this
    	.getSystemService(Context.INPUT_METHOD_SERVICE);
    	inputManager.hideSoftInputFromWindow(
    	AndroidRESTClientActivity.this.getCurrentFocus()
    	.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
    }
    private class WebServiceTask extends AsyncTask<String, Integer, String> {
    public static final int POST_TASK = 1;
    	public static final int GET_TASK = 2;
    	private static final String TAG = "WebServiceTask";
    	// connection timeout, in milliseconds (waiting to connect)
    	private static final int CONN_TIMEOUT = 3000;
    	// socket timeout, in milliseconds (waiting for data)
    	private static final int SOCKET_TIMEOUT = 5000;
    	private int taskType = GET_TASK;
    	private Context mContext = null;
    	private String processMessage = "Processing...";
    	private ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
    	private ProgressDialog pDlg = null;
     
    public WebServiceTask(int taskType, Context mContext, String processMessage) {
    	this.taskType = taskType;
    	this.mContext = mContext;
    	this.processMessage = processMessage;
    	}
     
    public void addNameValuePair(String name, String value) {
    	params.add(new BasicNameValuePair(name, value));
    	}
     
    private void showProgressDialog() {
    	pDlg = new ProgressDialog(mContext);
    	pDlg.setMessage(processMessage);
    	pDlg.setProgressDrawable(mContext.getWallpaper());
    	pDlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    	pDlg.setCancelable(false);
    	pDlg.show();
    	}
     
    @Override
    protected void onPreExecute() {
    	hideKeyboard();
    	showProgressDialog();
    	}
     
    protected String doInBackground(String... urls) {
    	String url = urls[0];
    	String result = "";
    	HttpResponse response = doResponse(url);
    	if (response == null) {
    		return result;
    	} else {
    		try {
    			result = inputStreamToString(response.getEntity().getContent());
    			} catch (IllegalStateException e) {
    				Log.e(TAG, e.getLocalizedMessage(), e);
    			} catch (IOException e) {
    				Log.e(TAG, e.getLocalizedMessage(), e);
    				}
    			}
    	return result;
    	}
     
    @Override
    protected void onPostExecute(String response) {
    	handleResponse(response);
    	pDlg.dismiss();
    	}
     
    // Establish connection and socket (data retrieval) timeouts
    private HttpParams getHttpParams() {
    	HttpParams htpp = new BasicHttpParams();
    	HttpConnectionParams.setConnectionTimeout(htpp, CONN_TIMEOUT);
    	HttpConnectionParams.setSoTimeout(htpp, SOCKET_TIMEOUT);
    	return htpp;
    	}
     
    private HttpResponse doResponse(String url) {
    // Use our connection and data timeouts as parameters for our
    // DefaultHttpClient
    	HttpClient httpclient = new DefaultHttpClient(getHttpParams());
    	HttpResponse response = null;
    	try {
    	switch (taskType) {
    	case POST_TASK:
    		HttpPost httppost = new HttpPost(url);
    		// Add parameters
    		httppost.setEntity(new UrlEncodedFormEntity(params));
    		response = httpclient.execute(httppost);
    		break;
    	case GET_TASK:
    		HttpGet httpget = new HttpGet(url);
    		response = httpclient.execute(httpget);
    		break;
    	}
    	} catch (Exception e) {
    	Log.e(TAG, e.getLocalizedMessage(), e);
    	}
    	return response;
    	}
    private String inputStreamToString(InputStream is) {
    	String line = "";
    	StringBuilder total = new StringBuilder();
    	// Wrap a BufferedReader around the InputStream
    	BufferedReader rd = new BufferedReader(new InputStreamReader(is));
    try {
    // Read response until the end
    	while ((line = rd.readLine()) != null) {
    	total.append(line);
    		}
    	} catch (IOException e) {
    		Log.e(TAG, e.getLocalizedMessage(), e);
    	}
    // Return full string
    return total.toString();
    		}
    	}
    }
    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
    package com.avilyne.rest.resource;
    import javax.ws.rs.Consumes;
    import javax.ws.rs.GET;
    import javax.ws.rs.POST;
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.Context;
    import javax.ws.rs.core.MediaType;
    import javax.ws.rs.core.MultivaluedMap;
    import javax.ws.rs.core.Request;
    import javax.ws.rs.core.UriInfo;
     
    import com.avilyne.rest.model.Person;
     
    @Path("/person")
    public class PersonResource {
     
    	private final static String FIRST_NAME = "firstName";
    	private final static String LAST_NAME = "lastName";
    	private final static String EMAIL = "email";
    	private Person person = new Person(1, "Sample", "Person", "sample_person@jerseyrest.com");
    // The @Context annotation allows us to have certain contextual objects
    // injected into this class.
    // UriInfo object allows us to get URI information (no kidding).
    @Context
    UriInfo uriInfo;
    // Another "injected" object. This allows us to use the information that's
    // part of any incoming request.
    // We could, for example, get header information, or the requestor's address.
    @Context
    Request request;
    // Basic "is the service running" test
     
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String respondAsReady() {
    	return "Demo service is ready!";
    }
    @GET
    @Path("sample")
    @Produces(MediaType.APPLICATION_JSON)
    public Person getSamplePerson() {
    	System.out.println("Returning sample person: " + person.getFirstName() + " " + person.getLastName());
    	return person;
    }
    // Use data from the client source to create a new Person object, returned in JSON format.
    @POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @Produces(MediaType.APPLICATION_JSON)
     
    public Person postPerson(MultivaluedMap<String, String> personParams) {
    	String firstName = personParams.getFirst(FIRST_NAME);
    	String lastName = personParams.getFirst(LAST_NAME);
    	String email = personParams.getFirst(EMAIL);
    	System.out.println("Storing posted " + firstName + " " + lastName + " " + email);
    	person.setFirstName(firstName);
    	person.setLastName(lastName);
    	person.setEmail(email);
    	System.out.println("person info: " + person.getFirstName() + " " + person.getLastName() + " " + person.getEmail());
    	return person;
    	}
    }
    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
    package com.avilyne.rest.model;
     
    import javax.xml.bind.annotation.XmlRootElement;
    @XmlRootElement
    public class Person {
     
    	private long id;
    	private String firstName;
    	private String lastName;
    	private String email;
     
    	public String getFirstName() {
    	return firstName;
    }
    public void setFirstName(String firstName) {
    	this.firstName = firstName;
    }
    public String getLastName() {
    	return lastName;
    }
    public void setLastName(String lastName) {
    	this.lastName = lastName;
    }
    public String getEmail() {
    	return email;
    }
    public void setEmail(String email) {
    	this.email = email;
    }
    public long getId() {
    	return id;
    }
    public void setId(long id) {
    	this.id = id;
    }
    public Person() {
    	id = -1;
    	firstName = "";
    	lastName = "";
    	email = "";
    }
    public Person(long id, String firstName, String lastName, String email) {
    	this.id = id;
    	this.firstName = firstName;
    	this.lastName = lastName;
    	this.email = email;
    }
     
    }

  2. #2
    Expert éminent

    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Février 2007
    Messages
    4 253
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Février 2007
    Messages : 4 253
    Points : 7 618
    Points
    7 618
    Billets dans le blog
    3
    Par défaut
    Les exceptions sont "empilées" car mal gérées... (pas gérées du tout en réalité):

    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
     
    HttpResponse response = doResponse(url);
    	if (response == null) {
    		return result;
    	} else {
    		try {
    			result = inputStreamToString(response.getEntity().getContent());
    			} catch (IllegalStateException e) {
    				Log.e(TAG, e.getLocalizedMessage(), e);
    			} catch (IOException e) {
    				Log.e(TAG, e.getLocalizedMessage(), e);
    				}
    			}
    	return result;
    	}
    suivi par:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    @Override
    protected void onPostExecute(String response) {
    	handleResponse(response);
    	pDlg.dismiss();
    	}
    Donc, même si la réponse n'est pas bonne on va appeler handleResponse() ce qui est évidemment faux (puisque celle-ci est vide) et donc créer dans:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    try {
    	JSONObject jso = new JSONObject(response);
    	String firstName = jso.getString("firstName");
    	String lastName = jso.getString("lastName");
    	String email = jso.getString("email");
    	edFirstName.setText(firstName);
    	edLastName.setText(lastName);
    	edEmail.setText(email);
    	} catch (Exception e) {
    	Log.e(TAG, e.getLocalizedMessage(), e);
    	}
    Une nouvelle exception...

    Le mieux est de conserver l'exception dans le doInBackground (on peut d'ailleurs catcher toutes les exceptions):
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
            String result = null;
            try {
                HttpResponse response = doResponse(url);
                result = inputStreamToString(response.getEntity().getContent());
    	} catch (Exception e) {
     	    Log.w(TAG, "Erreur dans l'AsyncTask", e);
                this.error = e;
            }
            return result;
    puis dans le onPostExecute:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
            if (result != null) {
                handleResult(result);
            } else {
                handleError(this.error);
            }
    Ensuite je ne comprends pas trop "inputStreamToString" !!
    Pourquoi ne pas utiliser simplement:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    EntityUtils.toString(response.getEntity())
    ?


    Pour l'erreur initiale... Le device est-il bien connecté en wi-fi ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    192.168.1.9:8080 timed out
    On dirait que le device n'est pas sur le même "réseau" que le serveur.
    N'oubliez pas de cliquer sur mais aussi sur si un commentaire vous a été utile !
    Et surtout

Discussions similaires

  1. Réponses: 1
    Dernier message: 06/08/2014, 10h10
  2. [WD16] Authentification avec un WebService
    Par DavidleVrai dans le forum WinDev
    Réponses: 6
    Dernier message: 23/07/2013, 16h45
  3. page d'authentification avec sql server
    Par alicia26 dans le forum ASP.NET
    Réponses: 11
    Dernier message: 14/05/2009, 18h19
  4. Problème d'authentification avec webService
    Par iDaaX dans le forum Services Web
    Réponses: 7
    Dernier message: 29/01/2007, 19h19
  5. Page d'authentification avec jsp
    Par taroudant dans le forum Servlets/JSP
    Réponses: 7
    Dernier message: 19/07/2006, 09h24

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo