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;
		}
 
	} | 
Partager