Developer

Data Requests

Send requests on behalf of the user.

After you complete the registration and initialize the secure store, you can request data from the back end with this MAF Logon Integration API call:
NSError* localError = nil;
MAFLogonRegistrationData* data = [self.logonManager registrationDataWithError:&localError];

if (localError) {
    //handle error
} else {
    //access registration data, like:
    self.appEndpoint = data.applicationEndpointURL;
    self.communicatorId = data.communicatorId;
}
Initialize the HttpConversationManager instance.
-(void) initializeConversationManager{
    self.manager = [[[HttpConversationManager alloc] init] autorelease];
}
Get the reference to the Configurator instance initialized by the MAF Logon upon a successful registration. Set the currently presented UIViewController instance as a parent view controller. Use the configurator to configure the HttpConversationManager instance with the Configurator:
/**
 * Update Conversation Manager with the currently persented UIViewController
 * @param: viewController the reference to the currently presented UIViewController
 */
-(void) configureConversationManagerWithParentViewController:(UIViewController *) viewController{
    //get Logon provided Conversation Manager Configurator
    id<ManagerConfiguratorProtocol> logonConfigurator = [logonUIViewManager.logonManager logonConfigurator];
    //update the reference to the provided UIViewController
    [logonConfigurator setParentView:viewController];
    //configure manager with the updated configurator
    [logonConfigurator configureManager:self.manager];
}
Create an instance of NSMutableRequest class. Depending on the registration type used by MAF Logon, you might need to construct the base URL.
  NSString *fullEndpoint = self.applicationEndpoint;
    NSString *serviceDocumentFormat = @"";
    if([self.communicatorId isEqualToString:idMAFLogonCommunicator_GatewayOnly]){
        NSString* serviceDocumentFormat = @"";
        if([fullEndpoint hasSuffix:@"/"]){
            serviceDocumentFormat = @"sap/opu/odata/GBHCM/LEAVEREQUEST/";
        }
        else{
            serviceDocumentFormat = @"/sap/opu/odata/GBHCM/LEAVEREQUEST/";
        }
        
        fullEndpoint = [fullEndpoint stringByAppendingString:serviceDocumentFormat];
        self.applicationEndpoint = fullEndpoint;
    }
    
    fullEndpoint = [fullEndpoint stringByAppendingString:serviceDocumentFormat];
    self.applicationEndpoint = fullEndpoint;
  NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:fullEndpoint]];
SMP registration requires additional headers:
if([self.communicatorId isEqualToString:idMAFLogonCommunicator_SMPHTTPREST]){
        if(self.applicationConnectionId){
            [request setValue:self.applicationConnectionId forHTTPHeaderField:@"X-SMP-APPCID"];
            [request setValue:self.applicationConnectionId forHTTPHeaderField:@"X-SUP-APPCID"];
        }
        if(self.securityConfig){
            [request setValue:self.securityConfig forHTTPHeaderField:@"X-SUP-SC"];
        }
        if(self.domain){
            [request setValue:self.domain forHTTPHeaderField:@"X-SUP-Domain"];
        }
    }
Execute the request with HttpConversationManager:
[_conversationManager executeRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
        /* Handle response, error and data! */
    }];