ผมเรียก web services ให้ ป้อน username , password แล้วให้ return กลับมาเป็น ชื่ออะครับ
แต่มันติดปัญหาที่มัน ไม่ส่งชื่อกลับมาอะครับ
public class ksoap2_webvice extends Activity {
//CheckLogin
private static final String URL = “http://192.168.10.99/Chawalit/service.asmx”;
private static final String SOAP_ACTION = “http://tempuri.org/CheckLogin”;
private static final String METHOD_NAME= “CheckLogin”;
private static final String NAMESPACE = “http://tempuri.org/”;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final TextView tv1=(TextView)findViewById(R.id.textView1);
final TextView tv2=(TextView)findViewById(R.id.TextView01);
final EditText et1 = (EditText)findViewById(R.id.editText1);
final EditText et2 = (EditText)findViewById(R.id.editText2);
final Button btn1 = (Button)findViewById(R.id.button1);
btn1.setOnClickListener(new Button.OnClickListener()
{
@SuppressWarnings(“deprecation”)
public void onClick(View v)
{
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
//Request.addProperty(“username”, et1.getText().toString());
//Request.addProperty(“password”, et2.getText().toString());
Request.addProperty(“username”, “b5128099”);
Request.addProperty(“password”, “123456”);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
aht.debug=true;
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
tv1.setText(“web_result :”+resultString.toString());
}
catch(Exception e)
{
tv1.setText(“web_result : Fail”);
e.printStackTrace();
}
tv2.setText(“app_result :”+et1.getText()+” “+et2.getText());
}
} );
}
}
ข้อมูลใน xml
http://image.free.in.th/show.php?id=d328dbb75108aeec7993c4f64acb83ef