Retrieve the response from the backend to the device.
/*Upon performing request using SDMRequestManager.makeRequest(SDMBaseRequest), the response will arrive at either public void onError(ISDMRequest arg0, ISDMResponse arg1, ISDMRequestStateElement arg2) {} or public void onSuccess(ISDMRequest aRequest, ISDMResponse aResponse) {} depending on whether the transaction was a failure or success respectively. Add the following in the onSuccess() method: */ HttpEntity responseEntity = aResponse.getEntity(); SDMParser parser = new SDMParser(mPreferences, mLogger); /*The response parsing depends on the type of document queried*/ if(serviceDoc) { ISDMODataServiceDocument serviceDoc = parser.parseSDMODataServiceDocumentXML(EntityUtils.toString(respons eEntity)); } else if(metadata) { ISDMODataSchema metaDoc = parser.parseSDMODataSchemaXML(EntityUtils.toString(responseEntity), serviceDoc); } else if(data) { List<ISDMODataEntry> dataSet = parser.parseSDMODataEntriesXML(EntityUtils.toString(responseEntity) , "CarrierCollection", metaDoc); }
Consume the parse data.
/*Iterate through the entries and get the required fields*/ Iterator<ISDMODataEntry> iterator = dataSet.iterator(); while (iterator.hasNext()) {Map<String,String> propertyValues = iterator.next().getPropertyValues(); Log.i(“SMP”,propertyValues.get("CARRNAME") +"\n"+propertyValues.get("carrid")); }