After you complete the registration and initialize the secure store, you can request data from the back end.
NSError* localError = nil;
MAFLogonRegistrationData* data = [self.logonManager registrationDataWithError:&localError];
if (localError) {
//handle error
} else {
//access registration data, like:
self.communicatorId = data.communicatorId;
self.appEndpoint = data.applicationEndpointURL;
}
/*
* returns an Request instance for the url
*/
-(id<Requesting>) requestWithURL:(NSURL *) url withMethodType:(NSString *)methodType{
id<Requesting> request = nil;
//getting the request object from SMP OData client library.
request = [RequestBuilder requestWithURL:url];
[request setUsername:self.registrationData.backendUserName];
[request setPassword:self.registrationData.backendPassword];
[request setRequestMethod:methodType];
if([self.registrationData.communicatorId isEqualToString:idMAFLogonCommunicator_SMPHTTPREST]){
[request addRequestHeader:@"X-SUP-APPCID" value:self.registrationData.applicationConnectionId];
[request addRequestHeader:@"X-SMP-APPCID" value:self.registrationData.applicationConnectionId];
}
return request;
}
You must add the X-SUP-APPCID and X-SMP-APPCID headers to the request if the communicatorId property is idMAFLogonCommunicator_SMPHTTPREST, otherwise the the SAP Mobile Platform server rejects the request.
NSString* fullEndpoint = self.applicationEndpoint;
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;
}