FunctionImport throwing 500 internal error

37 Views Asked by At

We have an old application written in objective-c using SMP framework SMP 3.0 SP12, and backend being SAP SMP Odata services, it's an offline based application but few functionalities only work in online mode. We are able to establish a connection successfully with the backend and login to the application.

After we are logged in we initiate various POST/GET requests either using the SMP framework scheduleCreateEntity offline method, and when the entity is saved in an offline DB we call - (void) scheduleFlushQueuedRequestsWithDelegate:(id<SODataOfflineStoreFlushDelegate>) delegate; requests to apply changes on backend services OR we can make request directly to onlineStore using FunctionImports methods. All the POST requests that we make using scheduleCreateEntity method are posted successfully, and we even receive correct responses back, similarly for FunctionImports most of them are working fine apart from a few calls, where we are receiving 500 internal server errors.

We also tried connecting with a backend team, who can support us on this issue, and they confirmed that my request did reach SAP and response is a success at SAP end, but we never received that success response back in our application. What we received as a response is 500 internal server ERROR . I have shared payload request and FunctionImport syntax below-:

The functionImport syntax defined in SMP Framework looks like given below-:

/**
 * Schedule a FunctionImport
 * Supported return types are Entiy or EntitySet. Please check the metadata because e.g. Complex Type is an unsupported return type.
 * @param resourcePath the path of the resource with FunctionImport
 * @param options additional paramaters dictionary
 * @param completionBlock block called once execution completes; note that the completion block is redirected to the main UI thread
 */

- (id<SODataRequestExecution>) scheduleFunction:(NSString*)resourcePath
                                        options:(NSDictionary*)options
                                     completion:(void (^)(id<SODataRequestExecution> requestExecution, NSError *error))completionBlock;

Payload request to call FunctionImport which is failing is given below-:

-(void)sendRequestPostDatal:(Material*)mi
                       successBlock:(void (^)(id<SODataRequestExecution>))successBlock
                         errorBlock:(void (^)(NSError*))errorBlock{
  
    [self checkOpenOnlineStoreSuccessBlock:^{

      NSString * resourcePath = [NSString stringWithFormat:@"entity?parameter1='%@'&parameter2='%@'&parameter3='%@'&parameter4='%@'&parameter5=%ldm&parameter6='%@'&parameter7='%@'&parameter8='%@'", mi.value, mi.value, mi.value, mi.value, (long)mi.value, mi.value, mi.value, mi.value];


           [self.onlineStore scheduleFunction:resourcePath options:nil completion:^(id<SODataRequestExecution> requestExecution, NSError* error){
            if( error != nil ){
                [UtilityManager dismissLoadingAlert];
            }
           
            [self callResponse:requestExecution error:error successBlock:successBlock errorBlock:errorBlock];
        }];
    
    }];
    
}

I have removed real parameters value and properties from resourcePath, but the syntax remains the same.

Anyhelp would be really appreciated. Thank you.

0

There are 0 best solutions below