I'm using SOAP service to get ticket. I'm sending user and pass, and I'm getting xml in String. For this I'm using ksoap2.
@Override
protected String doInBackground(String... params) {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty(USER, params[0]);
request.addProperty(PASS, params[1]);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.bodyOut = request;
soapEnvelope.setOutputSoapObject(request);
HttpTransportSE HttpTransport = new HttpTransportSE(URL);
try {
HttpTransport.call(SOAP_ACTION, soapEnvelope);
return soapEnvelope.getResponse().toString();
} catch (IOException | XmlPullParserException e) {
e.printStackTrace();
return null;
}
}
@Override
protected void onPostExecute(String XML) {
super.onPostExecute(XML);
if (result != null) {
// Here I need to get data from XML
}
}
My XML String looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<resp err="0">
<ticket>1234567989</ticket>
</resp>
So I need to get the error number, and the ticket number.