Streaming supports handling large data sent from device-to-server and vice-versa.
//Invoke the following method when response header is available to the application (void)headersArrived:(NSMutableDictionary*)headers; //Invoke the following method when a chunk of data is available to the application (void)request:(ODPRequest*)request didReceiveData:(NSData*)data; //Invoke the following method after all chunks of a response are received and when a request is completed (void)requestFinished:(ODPRequest*)request; //Invoke the following method to set the data chunks size [l_request setChunkSize:50000];
//Invoke the following method to enable streaming from device to server upload_request.shouldStreamPostDataFromDisk=YES; //Invoke the following method to provide the absolute file path on the device. This file path contains the upload data. [upload_request setPostBodyFilePath:filePath];
Example for uploading data from device to server ODPRequest* upload_request = [ODPRequest requestWithURL:[NSURL URLWithString:@"http://ldcigkq.wdf.sap.corp:50080/sap/opu/odata/iwfnd/RMTSAMPLEFLIGHT/TravelagencyCollection"]]; NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"uploadData.xml"]; [upload_request addRequestHeader:@"Content-Type" value:@"application/atom+xml"]; [upload_request setRequestMethod:@"POST"]; [upload_request setPostBodyFilePath:filePath]; upload_request.shouldStreamPostDataFromDisk=YES; upload_request.allowCompressedResponse=NO; [upload_request setUsername:@"supuser2"]; [upload_request setPassword:@"s3puser"]; [upload_request startSynchronous]; Example for downloading data from server to device ODPRequest * l_request=[ODPRequest requestWithURL:[NSURL URLWithString:@"http://vmw3815.wdf.sap.corp:50009/sap/opu/sdata/iwfnd/RMTSAMPLEFLIGHT/FlightCollection"]]; [l_request setAllowCompressedResponse:NO]; [l_request setUsername:@"supuser"]; [l_request setPassword:@"s3puser"]; [l_request setChunkSize:100000]; [l_request setDelegate:self]; [l_request setDidReceiveDataSelector:@selector(request:didReceiveData:)]; [l_request setDidReceiveResponseHeadersSelector:@selector(headersArrived:)]; [l_request setDidFinishSelector:@selector(requestFinished:)]; [l_request startSynchronous];