I am new to android and confused with my web services. I am using the following java code to get the response in log cat. but I tried a lot to parse the data to show the response alert dialouge . but I am getting huge errors and even i don’t know which methods and classes should be used
if reponse is 1 then success
if response is 0 then try again
The question might be silly but this is the only site where the new learners are getting the responses. kindly consider my problem
someone plz help with the relevant code to parse the string value to show the “success” alert.
Help is always appreciated…
request.addProperty("email", email);
request.addProperty("contact", contact);
request.addProperty("fname", fname);
request.addProperty("lname", lname);
request.addProperty("gender", gender);
request.addProperty("dateofbirth", dob);
request.addProperty("password", password);
request.addProperty("latitude", "76");
request.addProperty("longitude", "82");
request.addProperty("device_id", "12345");
aht.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
aht.call(SOAP_ACTION, soapEnvelope);
SoapObject resultsRequestSOAP = (SoapObject) soapEnvelope.bodyIn;
Log.v("TAG", String.valueOf(resultsRequestSOAP));
This is the xml from which I m getting the logcat response.
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05 /soap-envelope">
<soap12:Body>
<RegisterUser xmlns="http://tempuri.org/">
<email>string</email>
<contact>string</contact>
<fname>string</fname>
<lname>string</lname>
<gender>string</gender>
<dateofbirth>string</dateofbirth>
<password>string</password>
<latitude>int</latitude>
<longitude>int</longitude>
<device_id>string</device_id>
</RegisterUser>
</soap12:Body>
</soap12:Envelope>
from this xml I should parse the result
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<RegisterUserResponse xmlns="http://tempuri.org/">
<RegisterUserResult>string</RegisterUserResult>
</RegisterUserResponse>
</soap12:Body>
</soap12:Envelope>
If your question is about parsing an XML, then you should check this link, it should help you understand how the parsing goes in Android and in Java in general. Hope this helps!