public class MainActivity extends AppCompatActivity {
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;
envelope.encodingStyle = SoapEnvelope.ENC;
envelope.implicitTypes = false;
HttpTransportSE androidHttpTransport=new HttpTransportSE("http://192.168.33.46:11000/Service"); //url
androidHttpTransport.debug=true;
try{
androidHttpTransport.call("http://tempuri.org/IService/Login",envelope); //soap의 액션
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();
}
}
}
}
하....wcf랑 안드로이 쓰기 더럽게 어렵네
뭐가 문제냐 soap 버전 문제냐?
음..버전 뭐 쓰냐?
http://stackoverflow.com/questions/11492333/ksoap2-unexpected-typepositionend-document-null11-in-java-io-inputstreamread
이 문제 아님?
ksoap2-android-assembly-2.4-jar-with-dependencies 씀
@ㅇㅇ : 그럼 이 문제 맞는듯?
글이나 보고 와라. 걍 니가 문제인듯.
누가 이런코드를 시간내서 읽어줌