的WebMethod
public XmlElement findUserInfoById(int Id)
{
//string name = ""; string email = ""; string phone = "";
con.Open();
SqlCommand cmd = new SqlCommand("select*from tblUsers where Id ="+ Id, con);
cmd.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
XmlDataDocument xmldata = new XmlDataDocument(ds);
XmlElement xmlElement = xmldata.DocumentElement;
return xmlElement;
}
答案 0 :(得分:0)
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject response = (SoapObject) envelope.getResponse();
SoapObject s = (SoapObject) response.getProperty(0);
for (int i = 0;i<s.getPropertyCount();i++){
Object property = s.getProperty(i);
if(property instanceof SoapObject){
SoapObject category_list = (SoapObject) property;
String strName = category_list.getProperty("name").toString();
String strEmail = category_list.getProperty("email").toString();
String strPhone = category_list.getProperty("phone").toString();
Result = "Name : " + strName + "\nEmail : " + strEmail + "\nPhone : " + strPhone;
}
}
} catch (Exception e) {
e.printStackTrace();
}