Developer

Making HTTP Get Requests from Whitelisted Connections

Make HTTP Get requests from either whitelisted OData or JSON service connections.

Prerequisites

Define a whitelisted back-end connection used by the application in SAP Mobile Platform Server using the cockpit.

Procedure

  1. If the whitelisted connection is an OData service:
    1. Configure the HttpConversationManager with the MAFLogonManager’s logonConfigurator to respond to authentication challenges or use a CommonAuthenticationConfiguration and register the providers.
    2. Follow the steps Making HTTP Get Requests.
  2. If the whitelisted connection is a JSON service:
    1. Configure the HttpConversationManager with the MAFLogonManager’s logonConfigurator to respond to authentication challenges or use a CommonAuthenticationConfiguration and register the providers.
    2. Use HttpConversationManager to get data:
      -(void) logonFinishedWithError:(NSError*)anError {
          if (!anError) {
      
              	self.conversationManager = [[HttpConversationManager alloc] init];
      [self.logonUIViewManager.logonManager.logonConfigurator configureManager:self.conversationManager]; 
      		[self openOnlineStore];
      	}
      }
      
      
      Or:
      HttpConversationManager* manager = [[HttpConversationManager alloc] init];
      CommonAuthenticationConfigurator* commonConfig = [[CommonAuthenticationConfigurator alloc] init];
      [commonConfig configureManager:manager];
      self.conversationManager = manager;
      
      Download the data:
      NSMutableURLRequest* req = [NSMutableURLRequest requestWithURL:url];
          [self.httpConversationManager executeRequest:req 
      completionHandler:^(NSData *data, NSURLResponse *response, NSError *error_in) {
              //Process the downloaded data
          }];