android - Web server always returns true (Jdbc Driver) -


guys need bad. i'm developing android application in eclipse connects mysql database using web service. android app runs smoothly no problems web service. problem application return true when enter wrong username or password. can guys me figure out mistake?

also, console in webserver returning error.

package com.example.koios_beta5;  import org.ksoap2.soapenvelope; import org.ksoap2.serialization.propertyinfo; import org.ksoap2.serialization.soapobject; import org.ksoap2.serialization.soapprimitive; import org.ksoap2.serialization.soapserializationenvelope; import org.ksoap2.transport.httptransportse;  import android.os.asynctask; import android.os.bundle; import android.app.activity; import android.view.menu; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.textview; import android.widget.toast;  public class mainactivity extends activity {   private textview textview;  private edittext loginusername;  private edittext loginuserpassword;  private string launcher[];     @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     launcher = new string[2];      textview = (textview) findviewbyid(r.id.tv3);     loginusername = (edittext) findviewbyid(r.id.et1);     launcher[0] = loginusername.gettext().tostring();     loginuserpassword = (edittext) findviewbyid(r.id.et2);     launcher[1] = loginuserpassword.gettext().tostring();         button login = (button) findviewbyid(r.id.btn_login);     login.setonclicklistener(new view.onclicklistener() {             public void onclick(view arg0) { //          soapaccesstask myloginfetch = new soapaccesstask(); //          myloginfetch.execute(new string[] {    "user_name","user_password"});               accesswebservice(arg0);            }       });  }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.main, menu);     return true; }   private class soapaccesstask extends asynctask<string, void, string> {   //       @override //       protected void onpreexecute() { //            //if want, start progress dialog here //       }       @override      protected string doinbackground(string... urls) {          string webresponse = "";           try{          final string namespace = "http://ws.login_app_pw.com";          final string url =   "http://192.168.1.125:8080/login_app_desktop/services/login_app_pw?wsdl";          final string soap_action = "http://ws.login_app_pw.com/authentication";          final string method_name = "authentication";            soapobject request = new soapobject(namespace, method_name);           /*           edittext loginusername = (edittext) findviewbyid(r.id.et1);           urls[0] = loginusername.gettext().tostring();           edittext loginuserpassword = (edittext) findviewbyid(r.id.et2);           urls[1] = loginuserpassword.gettext().tostring();           */            propertyinfo unameprop =new propertyinfo();           unameprop.setname("username");            unameprop.setvalue(urls[0]);           unameprop.settype(string.class);           request.addproperty(unameprop);            propertyinfo passwordprop =new propertyinfo();           passwordprop.setname("password");           passwordprop.setvalue(urls[1]);           passwordprop.settype(string.class);           request.addproperty(passwordprop);            soapserializationenvelope envelope = new   soapserializationenvelope(soapenvelope.ver11);           //envelope.dotnet = true;           envelope.setoutputsoapobject(request);           httptransportse androidhttptransport = new httptransportse(url);            androidhttptransport.call(soap_action, envelope);           soapprimitive response = (soapprimitive)envelope.getresponse();           webresponse = response.tostring();        }        catch(exception e){           //toast.maketext(getapplicationcontext(),"cannot access web    service"+e.tostring(), toast.length_long).show();         }          return webresponse;     }      @override     protected void onpostexecute(string status) {             textview.settext(status);             toast.maketext(getapplicationcontext(),"completed...",    toast.length_long).show();          }      }     public void accesswebservice(view view) {            soapaccesstask task = new soapaccesstask();            task.execute(new string[] { launcher[0],launcher[1]});         // task.execute(launcher);          }          }    

for web server, i've

package org.androidapp.ws;  import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.preparedstatement;   public class login_instance {   public string authentication(string username,string password){        string retrievedusername = "";       string retrievedpassword = "";       string status = "";       try{         class.forname("com.mysql.jdbc.driver");        connection con =    drivermanager.getconnection("jdbc:mysql://localhost:3306/android_app","root","intercos2013"    );        preparedstatement statement =  con.preparestatement("select *    login_app user = '"+username+"'");        resultset result = statement.executequery();         while(result.next()){         retrievedusername = result.getstring("user");         retrievedpassword = result.getstring("password");         }             if(retrievedusername.equals(username)&&retrievedpassword.equals(password)){         status = "success!";        }         else{         status = "login fail!!!";        }        }       catch(exception e){        e.printstacktrace();       }       return status;       }  }  /*after creating classes, web-service has loaded tomcat server right click on class-->web service-->create webservice */ 

thanks in advance help


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -