마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

ksoap2 이용하는데 http 202코드도 예외로 잡아 버리네요...

0 추천
public class MainActivity extends AppCompatActivity {
    LoginBackgroundTask backgroundTask;
    static String ID;
    static String PW;

    @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) throws ExecutionException, InterruptedException {
        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();
       Object aa= backgroundTask.execute(new String[]{ID,PW}).get().toString();
        TextView tv=(TextView)findViewById(R.id.textView9);
        tv.setText(aa.toString());

         if(Integer.parseInt(aa.toString())==0)
        {
            Toast.makeText(this, "로그인 오류!", Toast.LENGTH_SHORT).show();
        }
        else if(Integer.parseInt(aa.toString())==1)
        {
            Intent stu= new Intent(getApplicationContext(),Student.class);
            startActivity(stu);
        }
        else if(Integer.parseInt(aa.toString())==2)
        {
            Intent tea= new Intent(getApplicationContext(),Teacher.class);
            startActivity(tea);
        }

        else if(Integer.parseInt(aa.toString())==3)
        {
            Intent stu= new Intent(getApplicationContext(),Student.class);
            startActivity(stu);
        }
        else
         {
             Toast.makeText(this,"안되",Toast.LENGTH_SHORT).show();
         }

    }

    public class LoginBackgroundTask extends AsyncTask<String,Integer,Object>
    {
        protected void onPostExecute(String result)
        {

        }
        @Override
        protected Object doInBackground(String...params)
        {
            SoapObject request = new SoapObject("http://tempuri.org/","Login");     // 네임스페이스 메소드 이름

            request.addProperty("user_id",params[0]);        //로그인시 전달할 아이디
            request.addProperty("pw",params[1]);             //로그인시 전달할 비번


            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;
            Object result=4;

            try {
                androidHttpTransport.call("http://tempuri.org/IService/Login",envelope);                        //soap의 액션
                result=envelope.getResponse();

            }
            catch (Exception e)
            {
               e.getStackTrace();

            }
            return result;
        }
    }
}

200번만 예외에서 제외하는데 

202번도 예외에서 제외 안시킬수 없나요 

탄빵 (310 포인트) 님이 2016년 7월 11일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...