Retrieving the Response from Backend

Retrieve the response from the backend to the device.

Upon performing request using [request startAsynchronous], the response will arrive at either - (void)requestFailed:(SDMHttpRequest*) request {} or  - (void)requestFinished:(SDMHttpRequest*) request {} depending on whether the transaction was a Failure or Success respectively.

Add the following in the - (void)requestFinished(SDMHttpRequest*) request method:

   /* The response parsing depends on the type of document queried whether its service document or metadata or
    OData*/
    if([[self.m_reqTypeDic objectForKey:KEY_REQUEST_TYPE] isEqualToString:SERVICE_DOC_REQUEST]) 
    {   
      /*Initialize the SDMODataServiceDocumentParser class object for parsing response service document
        data*/         
        SDMODataServiceDocumentParser
        *svcDocParser=[[[SDMODataServiceDocumentParser alloc]init]autorelease];              
        /* Parses the service document XML and converts it to an Objective-C service document object.*/
           [svcDocParser parse:[request responseData]];
          /* Service document instance can be accessed via the "serviceDocument" property of the parser after
             parsing*/            
             SDMODataServiceDocument
             *svcDoc=svcDocParser.serviceDocument;
         }

         else if([[self.m_reqTypeDic objectForKey:KEY_REQUEST_TYPE] isEqualToString:METADATA_REQUEST])
         { 
         /*Initialize the SDMODataMetaDocumentParser class object for parsing response meta data*/ 
           SDMODataMetaDocumentParser *metaDocParser=[[[SDMODataMetaDocumentParser
           alloc]initWithServiceDocument:svcDoc]autorelease]; 

           /*Parses and matches the schema with the service document and its collections.*/     

             [metaDocParser parse:[request responseData]];   

             /* The parser creates the schema of the input service document's collections and returns a collection by name */
               SDMODataCollection *carrierCollection=[svcDoc.schema getCollectionByName:@"CarrierCollection"];

               }  
               else if([[self.m_reqTypeDic objectForKey:KEY_REQUEST_TYPE] isEqualToString:ODATA_REQUEST])
               {
               /* Initialize the SDMODataDataParser class object for parsing any "inlined"entries or feed(s) when service
                  document is passed to the "initWithEntitySchema" variant that accepts service document as
                  input. If "inlined" feed(s) or entries should not be returned pass nil as the service
                  document parameter or use SDMODataDataParser* dataParser = [[SDMODataDataParser alloc] initWithEntitySchema: entitySchema] */     
                         
                  SDMODataDataParser *dataParser=[[[SDMODataDataParser alloc]initWithEntitySchema: carrierCollection.entitySchema andServiceDocument: svcDoc]autorelease];
                              
               /*Parses a feed or an entry xml.*/    
                 [dataParser parse:[request responseData]];                              

               /* The array of parsed entry/entries can be accessed via the "entries" property of the parser after parsing.
                  Array of SDMOdata Entries can be iterated and diplay the requisite data in tableview */

                  NSMutableArray * carriersList=[l_dataParser.entries retain];
         }