Aller au contenu
View in the app

A better way to browse. Learn more.

Forum de Frandroid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

authentification avec web service

Featured Replies

Posté(e)

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 :

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"

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

  • 3 months later...
Posté(e)

Bonjour, je crois simplement que les services web SOAP ne sont pas atteignables depuis un client android.

Je bute dessus depuis pas mal de temps, j'ai écumé le web et jamais trouvé la solution au plantage de la fonction qui appelle le service :

androidHttpTransport.call(SOAP_ACTION,envelope); l'erreur est là, mais personne ne sait expliquer.

Rejoignez la conversation

Vous pouvez poster maintenant et vous enregistrez plus tard. Si vous avez un compte, connectez-vous maintenant pour poster.

Invité
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Répondre à ce sujet…

Account

Navigation

Rechercher

Rechercher

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.