public class regist extends Activity{
RegBackgroundTask rbgt;
String ID;
String PW;
String NAME;
String PN;
String CID;
int TYPE;
boolean okreg;
public List<String> main_items = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.regist);
}
public int GetType() //가입타입받아오기
{
RadioGroup rg=(RadioGroup)findViewById(R.id.rb);
RadioButton rb=(RadioButton)findViewById(rg.getCheckedRadioButtonId());
String rbt=rb.toString();
if(rbt.equals("학생"))
{
return 1;
}
else if(rbt.equals("선생님"))
{
return 2;
}
else if(rbt.equals("학부모"))
{
return 3;
}
return 1;
}
public void click_stu(View v) //라디오-학생
{
EditText tt=(EditText)findViewById(R.id.childtext);
tt.setEnabled(false);
tt.setClickable(false);
tt.setFocusable(false);
}
public void click_pa(View v) //라디오-부모
{
EditText tt=(EditText)findViewById(R.id.childtext);
tt.setEnabled(true);
tt.setClickable(true);
tt.setFocusable(true);
tt.setFocusableInTouchMode(true);
}
public void click_tea(View v) //라디오-선생
{
EditText tt=(EditText)findViewById(R.id.childtext);
tt.setEnabled(false);
tt.setClickable(false);
tt.setFocusable(false);
}
public void click_ck(View v) //중복검사
{
}
public void click_reg(View v)
{
EditText id=(EditText)findViewById(R.id.id_text);
EditText pw=(EditText)findViewById(R.id.pwtext);
EditText name=(EditText)findViewById(R.id.nametext);
EditText pn=(EditText)findViewById(R.id.phonetext);
EditText cid=(EditText)findViewById(R.id.childtext);
ID=id.getText().toString();
PW=pw.getText().toString();
NAME=name.getText().toString();
PN=pn.getText().toString();
CID=cid.getText().toString();
RadioGroup rg=(RadioGroup)findViewById(R.id.rb);
RadioButton rb=(RadioButton)findViewById(rg.getCheckedRadioButtonId());
String select=rb.getText().toString();
EditText ck_pw=(EditText)findViewById(R.id.checkpw);
TYPE=GetType();
if(ID==null){
Toast.makeText(regist.this,"ID 항목이 비어있습니다",Toast.LENGTH_SHORT).show();}
if(PW==null){ Toast.makeText(regist.this,"비밀번호 항목이 비어있습니다",Toast.LENGTH_SHORT).show();}
if(NAME==null){Toast.makeText(regist.this,"이름 항목이 비어있습니다",Toast.LENGTH_SHORT).show();}
if(PN==null){Toast.makeText(regist.this,"전화번호 항목이 비어있습니다",Toast.LENGTH_SHORT).show();}
String tt=Integer.toString(TYPE);
rbgt=new RegBackgroundTask();
rbgt.execute(new String[]{ID,PW,NAME,PN,tt,CID});
if(okreg==true){ Toast.makeText(regist.this,"가입성공",Toast.LENGTH_SHORT).show(); }
else{Toast.makeText(regist.this,"실패",Toast.LENGTH_SHORT).show();}
}
public class RegBackgroundTask extends AsyncTask<String,String,String>
{
protected void onPostExecute()
{
}
@Override
protected String doInBackground(String...params)
{
SoapObject request = new SoapObject("http://tempuri.org/","Join");
request.addProperty("user_id",params[0]); //가입시 전달할 아이디
request.addProperty("pw",params[1]); //로그인시 전달할 비번
request.addProperty("name",params[2]); //가입시 전달할 이름
request.addProperty("phonnum",params[3]); //가입시 전달할 전화번호
request.addProperty("type",Integer.parseInt(params[4])); //가입시 전달할 가입 타입
request.addProperty("children_id", params[5]); //가입시 전달할 자식 아이디
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
envelope.setOutputSoapObject(request);
envelope.dotNet=true;
HttpTransportSE androidHttpTransport=new HttpTransportSE("http://192.168.33.46:11000/Service");
try{
androidHttpTransport.call("http://tempuri.org/IService/Join",envelope);
Object result=envelope.getResponse();
String Re=result.toString();
okreg= Boolean.valueOf(Re).booleanValue();
return Re;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
}
}
RegBackgroundTask rbgt;
String ID;
String PW;
String NAME;
String PN;
String CID;
int TYPE;
boolean okreg;
public List<String> main_items = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.regist);
}
public int GetType() //가입타입받아오기
{
RadioGroup rg=(RadioGroup)findViewById(R.id.rb);
RadioButton rb=(RadioButton)findViewById(rg.getCheckedRadioButtonId());
String rbt=rb.toString();
if(rbt.equals("학생"))
{
return 1;
}
else if(rbt.equals("선생님"))
{
return 2;
}
else if(rbt.equals("학부모"))
{
return 3;
}
return 1;
}
public void click_stu(View v) //라디오-학생
{
EditText tt=(EditText)findViewById(R.id.childtext);
tt.setEnabled(false);
tt.setClickable(false);
tt.setFocusable(false);
}
public void click_pa(View v) //라디오-부모
{
EditText tt=(EditText)findViewById(R.id.childtext);
tt.setEnabled(true);
tt.setClickable(true);
tt.setFocusable(true);
tt.setFocusableInTouchMode(true);
}
public void click_tea(View v) //라디오-선생
{
EditText tt=(EditText)findViewById(R.id.childtext);
tt.setEnabled(false);
tt.setClickable(false);
tt.setFocusable(false);
}
public void click_ck(View v) //중복검사
{
}
public void click_reg(View v)
{
EditText id=(EditText)findViewById(R.id.id_text);
EditText pw=(EditText)findViewById(R.id.pwtext);
EditText name=(EditText)findViewById(R.id.nametext);
EditText pn=(EditText)findViewById(R.id.phonetext);
EditText cid=(EditText)findViewById(R.id.childtext);
ID=id.getText().toString();
PW=pw.getText().toString();
NAME=name.getText().toString();
PN=pn.getText().toString();
CID=cid.getText().toString();
RadioGroup rg=(RadioGroup)findViewById(R.id.rb);
RadioButton rb=(RadioButton)findViewById(rg.getCheckedRadioButtonId());
String select=rb.getText().toString();
EditText ck_pw=(EditText)findViewById(R.id.checkpw);
TYPE=GetType();
if(ID==null){
Toast.makeText(regist.this,"ID 항목이 비어있습니다",Toast.LENGTH_SHORT).show();}
if(PW==null){ Toast.makeText(regist.this,"비밀번호 항목이 비어있습니다",Toast.LENGTH_SHORT).show();}
if(NAME==null){Toast.makeText(regist.this,"이름 항목이 비어있습니다",Toast.LENGTH_SHORT).show();}
if(PN==null){Toast.makeText(regist.this,"전화번호 항목이 비어있습니다",Toast.LENGTH_SHORT).show();}
String tt=Integer.toString(TYPE);
rbgt=new RegBackgroundTask();
rbgt.execute(new String[]{ID,PW,NAME,PN,tt,CID});
if(okreg==true){ Toast.makeText(regist.this,"가입성공",Toast.LENGTH_SHORT).show(); }
else{Toast.makeText(regist.this,"실패",Toast.LENGTH_SHORT).show();}
}
public class RegBackgroundTask extends AsyncTask<String,String,String>
{
protected void onPostExecute()
{
}
@Override
protected String doInBackground(String...params)
{
SoapObject request = new SoapObject("http://tempuri.org/","Join");
request.addProperty("user_id",params[0]); //가입시 전달할 아이디
request.addProperty("pw",params[1]); //로그인시 전달할 비번
request.addProperty("name",params[2]); //가입시 전달할 이름
request.addProperty("phonnum",params[3]); //가입시 전달할 전화번호
request.addProperty("type",Integer.parseInt(params[4])); //가입시 전달할 가입 타입
request.addProperty("children_id", params[5]); //가입시 전달할 자식 아이디
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
envelope.setOutputSoapObject(request);
envelope.dotNet=true;
HttpTransportSE androidHttpTransport=new HttpTransportSE("http://192.168.33.46:11000/Service");
try{
androidHttpTransport.call("http://tempuri.org/IService/Join",envelope);
Object result=envelope.getResponse();
String Re=result.toString();
okreg= Boolean.valueOf(Re).booleanValue();
return Re;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
}
}
202가 나왔다는건 내가 잘못된걸 보낸건가?
연결 신호는 보내고 서버에서 수신은 했는데 보낸게 잘못된거 맞지?
내가 비동기식을 잘못쓴것같은데
말을 왤케 못 알아 쳐묵냐;; 202 나온건 제대로 요청은 한거임.
근데 예를들어서 일하는데 좀 시간이 걸리면 얌마~너 좀따가 이쪽으로 붙여서 요청해봐. 내가 일 끝나면 일루 쏴줌..ㅇㅇ
한거임..니 UI비동기 얘기한거 아니라..일단 저쪽에서 아마 HTTP헤더쪽에 202말고 따로 실어나른게 있을꺼임..
그 정보를 가지고 처리해야함.. 내 말대로 그냥 니가 보내는 SOAP메시지 걍 툴로 생성해서 보내봐. 헤더에 뭐뭐 묻혀서 오는지 확인해보기 바란다..
http://restcookbook.com/Resources/asynchroneous-operations/
이런 느낌이다. 이해됨?
SOAP은 한 10년전에 잠깐 본거라 자세히는 몰라서 찾아봄.
https://www.w3.org/TR/soap12-part2/#http-reqbindwaitstate에
보면 202는 The request has been accepted, but either (a) no response envelope is provided or (b) an envelope representing information related to the request is provided -- such envelopes SHOULD be processed using the SOAP Processing model (see SOAP 1.2 Part 1 [SOAP Part 1], section SOAP Processing Model)
라고 되어 있다.
전혀 문제 없는 코드라는 얘기. 걍 HttpResponseException예외 받아서 getResponseHeaders메소드 호출해서 일단 헤더들 쭉 찍어봐.
ㄴ고마워요 설띵충!!!!
ksoap2소스는 그냥 200 아니면 무조건 예외를 때리네..-_-; 근데 쓰여있는것처럼 본문이 있을수도 있는데 그건 또 SOAP모델로 처리해야하는데-_-; 왜 그렇게 구현해놨지;;
어째튼 SOAP은 구시대적인 퇴물이니 얼른 탈출요망.. 그리고 검색 좀 해봐라..-_-;;