在我的應用程序中,如果結果成功,我想聯繫web服務並返回一個布爾值。我出於安全原因解析了5個字段,但我不知道如何使用soap發送和接收輸入和輸出。我跟着一個w3school的例子,它用一個輸入工作正常,但現在我對幾個數據感到困惑。請幫助,這是我的代碼。Soap使用5個參數登錄android
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapObject loginTo = new SoapObject(NAMESPACE, "LoginDetail");
PropertyInfo pi = new PropertyInfo();
loginTo.addAttribute("idCon", "124059432");
loginTo.addProperty("codeSession", "1234");
loginTo.addProperty("type","CLIENT");
loginTo.addProperty("client_number","167");
loginTo.addProperty("account_num","3403");
loginTo.addProperty("codeAuth","333");
request.addProperty("loginDetails", loginTo);
Log.e("Soap Request : ", "" + request);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE aht = new HttpTransportSE(URL);
try {
aht.call(SOAP_ACTION, envelope);
SoapObject response = (SoapObject) envelope.getResponse();
Log.e ("login result", response.toString()); //lblResult.setText(results.toString());
Boolean loginStatus = Boolean.getBoolean(response.getProperty("success").toString());
} catch (Exception e) {
e.printStackTrace();
}
嗨。你爲什麼使用兩個SoapObject? – Nirmal 2013-03-26 12:36:02
我看到一個新的例子,所以我想示例 – yakusha 2013-03-26 12:50:11
好的。你有沒有試過我的答案。 – Nirmal 2013-03-26 12:53:46