Examples for Supported Features

Example - Request Initialization

NSString* serverUrlWithLanguage = [NSString stringWithFormat:@"%@?sap-language=%@",[ConnectivitySettings url],[[ConnectivitySettings instance] currentLanguage]];
[self setRequest:[SDMHTTPRequest requestWithURL:[NSURL URLWithString: serverUrlWithLanguage]]];

NSString* serverUrlWithLanguage = [NSString stringWithFormat:@"%@?sap-language=%@",[ConnectivitySettings url],[[ConnectivitySettings instance] currentLanguage]];
m_AsynchRequest = [HTTPRequest requestWithURL:[NSURL URLWithString: serverUrlWithLanguage]];

[m_AsynchRequest setDidFinishSelector:@selector(serviceDocFetchComplete:)];

[m_AsynchRequest setDidFailSelector:@selector(serviceDocFetchFailed:)];

[m_AsynchRequest setRequestMethod:@”POST”];

Example - Request Execution

[m_AsynchRequest startSynchronous];

[m_AsynchRequest cancel];

Example - Progress Tracking

[m_AsynchRequest setUploadProgressDelegate:m_ProgressIndicator]; 

Example - Request Payload

NSString* stringPayload = [m_AsynchRequest responseString];

NSData* binaryPayload = [m_AsynchRequest responseData];

Example - Request Setup

[m_AsynchRequest addRequestHeader:@"myApplicationId" value:kAppId];
[m_AsynchRequest addRequestHeader:@"deviceType" value:@"iphone"];

[m_AsynchRequest appendPostData:urlEncData];
NSData* encodedPostData = [encodedPostStr dataUsingEncoding:NSUTF8StringEncoding];
[m_AsynchRequest appendPostData:encodedPostData];
// once we have them all, build the POST body
 [m_AsynchRequest buildPostBody];

[m_AsynchRequest addRequestHeader:@"myApplicationId" value:kAppId];
[m_AsynchRequest addRequestHeader:@"deviceType" value:@"iphone"];

Example - ETag Support

id<SDMRequesting> request;
request = [SDMRequestBuilder requestWithURL:[NSURL URLWithString:@"http://vmw3811.wdf.sap.corp:50075/sap/opu/sdata/sap/FINCUSTFACTSHEET/GOSNoteCollection(CustomerNo='MG001',CompanyCode='0001',NoteID='FOL33000000000004RAW37000000000007')"]];
[request setEtag:@"201201130306299" withMatchType:EtagIfMatch];
[request setUsername:@"user"];
[request setPassword:@"password"];
 [request setDelegate:self];
 [request setDidFinishSelector:@selector(collectionEntriesSuccess:)];
 [request setDidFailSelector:@selector(collectionEntriesFailure:)];
 [request startAsynchronous];