Bonsoir,
J'ai crée un web service d'un méthode authentification en s’appuyant sur les annotations et SOAP comme suit:
Faut t-il ajouter ajouter quelques annotations pour que mon code fonctionne correctement et mon service soit consommable depuis un client android.
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 @WebService(serviceName = "authentificationService", targetNamespace = "http://webservices/") public class authentification { String user1 = ""; String pass1 = ""; int id = -1; @WebMethod(operationName = "Login") public int Login(@WebParam(name = "LOGIN") String user, @WebParam(name = "PASS") String pass) { try { String req = "select * from commercial where LOGIN='" + user + "' and PASS='" + pass + "'"; Statement st = PMConnexion.getInstance().createStatement(); ResultSet rs = st.executeQuery(req); while (rs.next()) { user1 = rs.getString("LOGIN"); pass1 = rs.getString("PASS"); id = rs.getInt("ID_COM"); } return id; } catch (Exception e) { System.out.println(e.getMessage()); return id; } }
Faut-il ajouter l'annotation @remote, @statless ou @statefull ?
Merci par avance de votre retour.
Partager