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 :

Erreur d'authentification


Sujet :

Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Janvier 2010
    Messages
    391
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Mauritanie

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Janvier 2010
    Messages : 391
    Par défaut Erreur d'authentification
    bonsoir j ai un petit problème d authentfication a un serveur wcs(webpshere) a distance , je vous montre mon code vous regarder si ya des erreurs car j arrive toujours pas a me connecter , je suis un debutant android et webservice
    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
     
     
    public class Authentification extends Activity {
        /** Called when the activity is first created. */
    	  String  response ;
    	final String username = "19851985";
    	String result;
        final String password = "ddddd85";
     
        HttpResponse httpresponse;
    	InputStream chaine;
     
        final String proxyHost = "http://10.0.2.2/webapp/wcs/boutique/servlet/Address?storeId=10101&catalogId=10101&langId=-2"; 
        final int proxyPort = 80; 
     
        String url="http://10.0.2.2/webapp/wcs/boutique/servlet/Address?storeId=10101&catalogId=10101&langId=-2";
     
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
     
            ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
       		nameValuePairs.add(new BasicNameValuePair("username ", username ));
       		nameValuePairs.add(new BasicNameValuePair("password ", password));
     
               DefaultHttpClient  client  = new DefaultHttpClient();
     
     
            	HttpEntity entity;
           	HttpPost httpGet = new 	HttpPost(url);
     
           	try {
    			httpGet.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    		} catch (UnsupportedEncodingException e1) {
    			// TODO Auto-generated catch block
    			e1.printStackTrace();
    		}
           httpGet.addHeader("User-Agent", "Android");
     
            	HttpConnectionParams.setConnectionTimeout(client.getParams(), 15000);
     
    			try {
    				httpresponse = client.execute(httpGet);
    			} catch (ClientProtocolException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			} catch (IOException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
            	entity = httpresponse.getEntity();
     
    			try {
    				chaine = entity.getContent();
    			} catch (IllegalStateException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			} catch (IOException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
    			try {
    				result = stream2String(chaine);
    			} catch (UnsupportedEncodingException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
     
    			JSONArray jsonOrdArray = null;
    			try {
    				jsonOrdArray = new JSONArray(result);
    			} catch (JSONException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
     
    			for(int  i=0;i<jsonOrdArray.length();i++)
    			{
    				Order order = new Order();
    				 JSONObject commande = null;
    				try {
    					commande = jsonOrdArray.getJSONObject(i);
    				} catch (JSONException e) {
    					// TODO Auto-generated catch block
    					e.printStackTrace();
    				}
    				 try {
    					order.reference= commande.getString("reference");
    				} catch (JSONException e) {
    					// TODO Auto-generated catch block
    					e.printStackTrace();
    				}
    			}
     
     
     
            }
     
     
        private String stream2String(InputStream stream)
    	throws UnsupportedEncodingException {
    String charSet = "iso-8859-1";
    InputStreamReader reader = new InputStreamReader(stream, charSet);
     
    BufferedReader buffer = new BufferedReader(reader);
    StringBuilder sb = new StringBuilder();
    try {
    	String cur;
    	while ((cur = buffer.readLine()) != null) {
    		sb.append(cur);
    	}
    } catch (IOException e) {
    	e.printStackTrace();
    }
    try {
    	stream.close();
    } catch (IOException e) {
    	e.printStackTrace();
    }
    return sb.toString();
    }
     
    }

  2. #2
    Expert confirmé

    Avatar de Feanorin
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    4 589
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 4 589
    Par défaut
    Bonjour,
    bonsoir j ai un petit problème d authentfication a un serveur wcs(webpshere) a distance , je vous montre mon code vous regarder si ya des erreurs car j arrive toujours pas a me connecter , je suis un debutant android et webservice
    Qu'as tu comme erreur d'authentification lors de ta tentative de connexion ?

    Merci.

  3. #3
    Membre éclairé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Janvier 2010
    Messages
    391
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Mauritanie

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Janvier 2010
    Messages : 391
    Par défaut
    bonjour merci pour ta reponse voici les messages de warning qu il m affiche .

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
     
    06-07 08:17:52.947: WARN/InputManagerService(58): Got RemoteException sending setActive(false) notification to pid 2423 uid 10036
    06-07 08:17:53.937: WARN/PackageManager(58): Code path for pkg : com.connexion changing from /data/app/com.connexion-1.apk to /data/app/com.connexion-2.apk
    06-07 08:17:53.937: WARN/PackageManager(58): Resource path for pkg : com.connexion changing from /data/app/com.connexion-1.apk to /data/app/com.connexion-2.apk
    06-07 08:17:55.187: WARN/RecognitionManagerService(58): no available voice recognition services found
    06-07 08:17:59.258: WARN/System.err(2474): org.json.JSONException: Value null at 0 of type org.json.JSONObject$1 cannot be converted to JSONObject
    06-07 08:17:59.258: WARN/System.err(2474):     at org.json.JSON.typeMismatch(JSON.java:96)
    06-07 08:17:59.286: WARN/System.err(2474):     at org.json.JSONArray.getJSONObject(JSONArray.java:484)
    06-07 08:17:59.286: WARN/System.err(2474):     at com.connexion.Authentification$1.run(Authentification.java:84)

    si je comprend bien la connexion ne passe pas c est pourquoi il va me retourner une page vide et si je veux parcours a partir de json je vais parcourir un tableau vide d ou le nullPointerException . j aimerai savoir est ce que la façon dont j ai codé la connexion est bonne merci d avance

Discussions similaires

  1. Page d'erreur d'authentification
    Par yashiro dans le forum Tomcat et TomEE
    Réponses: 2
    Dernier message: 03/11/2008, 18h02
  2. Rediriger les erreurs d'authentification avec syslog
    Par ibhow dans le forum Administration système
    Réponses: 1
    Dernier message: 07/08/2008, 20h23
  3. hamster + erreur d'authentification POP3
    Par une_tite_question dans le forum Windows Serveur
    Réponses: 1
    Dernier message: 27/05/2008, 20h48
  4. [OWA 2007] Message d'erreur après authentification
    Par phoenix75 dans le forum Exchange Server
    Réponses: 0
    Dernier message: 29/02/2008, 10h31
  5. [PostgreSQL] [PostgreSQL] erreur d'authentification
    Par snipes dans le forum PHP & Base de données
    Réponses: 4
    Dernier message: 11/05/2007, 01h22

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