Sending Data Request to the Backend

Send a data request to the back-end through the SAP Mobile Server asynchronously.

Initialize the SMPAppSettings class which takes client connection object as one of the parameter using SMPAppSettings *appSettingsObj=[SMPAppSettings initializeWithConnection:clientConn userName:username password:password];

/*Initialize the application settings class which takes client connection object as one of the parameters */ 

   SMPAppSettings *appSettingsObj=[ SMPAppSettings   initializeWithConnection :clientConn  userName : @”supuser”   password : @”s3puser” ];

   /* Get the application endpoint using [appSettingsObj getApplicationEndpointWithError:error]        */   

    NSString * appEndPoint =[appSettingsObj getApplicationEndpointWithError:nil]; 

    /*Initialize the SDMRequesting class object with the endpoint URL after successful registration */
      id<SDMRequesting> request=nil;
      if([[self.m_reqTypeDic objectForKey:KEY_REQUEST_TYPE] isEqualToString:SERVICE_DOC_REQUEST]) 
      {     
       /* Get Service Document    */
         request = [SDMRequestBuilder requestWithURL:[NSURL URLWithString:appEndPoint]];
       }
       else if([[self.m_reqTypeDic objectForKey:KEY_REQUEST_TYPE] isEqualToString:METADATA_REQUEST])           
       {
        /* Get metadata   */
        request=[SDMRequestBuilder requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/$metadata",m_AppEndPoint]]];
       }
        else if([[self.m_reqTypeDic objectForKey:KEY_REQUEST_TYPE] isEqualToString:ODATA_REQUEST])
        { 
         /* To get required flight collection. For example: CarrierCollection */
         request=[SDMRequestBuilder requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/CarrierCollection", appEndPoint]]]; 
        }  
         /*Set Username in SDMRequesting object*/
         [request setUsername: @”supuser”];  
                   
         /*Set Password in SDMRequesting object*/
         [request setPassword: @”s3puser”];  

         /*Set the Delegate. This class must adhere to SDMHttpRequestDelegate to get callback*/
         [request setDelegate:self];                              

         /*Call startAsynchronous API to request object to retreive Data asynchronously in the call backs */
         [request startAsynchronous];