------------------------------------------------------------------------------------------------------
//AAsyncTask mTask;
LoginBackgroundTask backgroundTask;
static String ID;
static String PW;
static int asklogin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void click_regist(View v)
{
Intent it= new Intent(getApplicationContext(),regist.class);
startActivity(it);
}
public void click_login(View v) {
EditText ido=(EditText)findViewById(R.id.idtext);
EditText pwo=(EditText)findViewById(R.id.pwtext);
ID=ido.getText().toString();
PW=pwo.getText().toString();
backgroundTask =new LoginBackgroundTask();
backgroundTask.execute();
if(asklogin==0)
{
Toast.makeText(this, "로그인 오류!", Toast.LENGTH_SHORT).show();
}
else if(asklogin==1)
{
Intent stu= new Intent(getApplicationContext(),Student.class);
startActivity(stu);
}
else if(asklogin==2)
{
Intent tea= new Intent(getApplicationContext(),Teacher.class);
startActivity(tea);
}
else if(asklogin==3)
{
Intent stu= new Intent(getApplicationContext(),Student.class);
startActivity(stu);
}
}
public class LoginBackgroundTask extends AsyncTask<String,Integer,String>
{
protected void onPostExecute(String result)
{
super.onPostExecute(result);
}
@Override
protected String doInBackground(String...params)
{
SoapObject request = new SoapObject("http://tempuri.org/","Login");
request.addProperty("user_id",ID); //로그인시 전달할 아이디
request.addProperty("pw",PW); //로그인시 전달할 비번
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
envelope.setOutputSoapObject(request);
envelope.dotNet=true;
HttpTransportSE androidHttpTransport=new HttpTransportSE("http://192.168.33.49:11000/Service");
try{
androidHttpTransport.call("http://tempuri.org/IService/Login",envelope);
Object result=envelope.getResponse();
String Re=result.toString();
int ii=Integer.parseInt(Re);
asklogin=ii;
return Re;
}
catch (Exception e)
{
e.printStackTrace();
return e.getLocalizedMessage();
}
}
}
}
--------------------------------------------------------------------------------------------------------------------------------------
http://192.168.33.49:11000/?wsdl 는 wcf 웹서버(남이 짠거)
에 연결하는데 아래 코드가 말썽임
위에 써잇는게 오류 코드
됫->됐 (되어 = 돼임) [리듬 맞춤법 봇♬]
정답은 절대 안알려주네 좆같은 문법나치봇 같으니라고
서버에서 요청 xml로 받는 거야?
http://android-developers-kr.blogspot.kr/2012/01/xmlpullparsernexttext.html
여기 참고해 보면 좋을지도?