cancel
Showing results for 
Search instead for 
Did you mean: 

SMP SDK 3.0 SP10 PL01 Offline

0 Kudos

Hi Team,

I have a scenario were i have to retrieve data from multiple system.

I am able to create multiple "ONLINE" stores and retrieve data as well. But i am trying to retrieving the data in offline mode  i am geting error like below

E/com.sap.smp.client.ios.odata.offline: [-10210] The operation failed due to an error on the server: The conversion from OData metadata to database metadata has failed

due to above error offline store in able to open like error below

com.innovapptive.ticdev.mworklist E/com.sap.smp.client.ios.odata.offline: [-10058] Cannot perform the requested operation because the store is not open.

Above is the error received in Android , below is received in IOS

com.sap.smp.client.ios.odata.offline ERROR [-10028] Error at URL position 1: "Tracks" is not an entity set in entity container "MWORKLIST_2_SRV_Entities

Below is the code i am using for opening offline store. here i am using different error listeners, store listener, encryptionKey and Store Name for different stores.

/**
  * Open Offline Store
  *
  * @param context
   * @return
   * @throws offline odata Store Exception
  */
   public boolean openOfflineStore(Context context) throws OfflineODataStoreException {

   //BEGIN
   writeLogsOfSMP();

   if (offlineStorePTS == null) {

   try {

   offlineOpenListener = OfflineOpenListenerPTS.getInstance();

   //This instantiate the native UDB libraries which are located in the libodataofflinejni.so file
   ODataOfflineStore.globalInit();

   //Get application endpoint URL
   LogonCoreContext lgCtx = LogonCore.getInstance().getLogonContext();

  String endPointURL = Utils.DOLPHIN_SERVER;

  URL url = new URL(endPointURL);

   // Define the offline store options.
  // Connection parameter and credentials and
  // the application connection id we got at the registration
   ODataOfflineStoreOptions options = new ODataOfflineStoreOptions();

  options.host = url.getHost();

  options.port = String.valueOf(url.getPort());

  options.enableHTTPS = lgCtx.isHttps();

  options.serviceRoot = endPointURL;//SharedPreferencesHelper.getDefaults(SharedPreferencesHelper.PREFS_KEY_APP_CID, mContext);
   options.storeEncryptionKey = "SuperSecretEncryptionkeyPTS";

   //The logon configurator uses the information obtained in the registration
  // (i.e endpoint URL, login, etc ) to configure the conversation manager
   HttpConversationManager manager = new HttpConversationManager(context);

// configurator.configure(manager);
   options.conversationManager = manager;

  options.enableRepeatableRequests = false;

  String appCID = SharedPreferencesHelper.getDefaults(SharedPreferencesHelper.PREFS_KEY_APP_CID, mContext);

  options.storeName = "mWorklistStorePTS";//
   options.customHeaders.put("X-SMP-APPCID", lgCtx.getConnId());

   //This defines the oData collections which will be stored in the offline store
// options.addDefiningRequest("req1", PR_LIST_COLLECTION +"", false);
   options.addDefiningRequest("req1", Tracks +"?$skip=0&$filter=MyApprovals eq true&$inlinecount=allpages", false); //
   options.addDefiningRequest("req2", StatusSet, false);

// options.addDefiningRequest("req3", Tracks + "?$expand="+ InvoiceItems, false);
// options.addDefiningRequest("req4", Tracks + "?$expand=Attachments", false);
// options.addDefiningRequest("req5", Tracks + "?$expand=Approvers", false);
// options.addDefiningRequest("req6", Tracks + "?$expand="+ Notes, false);

  //Open offline store
   offlineStorePTS = new ODataOfflineStore(context);

   offlineStorePTS.setRequestErrorListener(new MyODataOfflineStoreRequestErrorListener());

   offlineStorePTS.setOfflineStoreListener(offlineOpenListener);

   offlineStorePTS.openStoreSync(options);

// Log.i("OpenOfflineStore", "openOfflineStore: library version PTS = " + ODataOfflineStore.libraryVersion());
   writeLogsOfSMP();

   return true;

  } catch (Exception e) {

  writeLogsOfSMP();

   throw new OfflineODataStoreException(e);

  }

  } else {

   return true;

  }

   //END
   }

when i traced out the flow what i got to understand is that when login to one system the base end point url is getting generated for the particular system and for others systems manually generating urls for other systems.

Once login with the one system data retrieved in online store and then at the same time metadata of that system is saved in device for offline store.

For other systems the in offline mode it is using the same base end point url is used for other systems as well.

Can anyone let know were is going wrong or i am doing wrong.

Can anyone help me out for this type of issue or if anyone faced this type of error before.

Thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hi

Please have a look and help us on this issue. We have also raised an OSS ticket on this with no update.

Thanks

Sudhakar Pachava

former_member190800
Contributor
0 Kudos

Since you are getting the same error on both iOS and Android, it seems most likely that it is a configuration issue.  I see a note on this post:  Problem with opening two online and offline stores in a single application using SP 10 for native iO...  (these are 3 duplicate of the same question) Praveen believes that this collection:  AP_GW_SRV should be called, instead of MWORKLIST_2_SRV_Entities. 

It is not clear to me that these are correctly configured in the SMP Admin cockpit, and referenced from the OfflineStore correctly.  Certainly, review this document:  in sections:  "Offline and Online in One App" (since it has good screenshots and example URLs), and "Using More than one Offline Store".

It looks to me, like you ought to have two endpoints configured in your Admin Cockpit, like here:  image13.PNG. And, the service root for each store should reference these unique connection names. 

Can you share the following: 

  1. a screenshot of the endpoints configured in the Admin Cockpit, as in image13.png. 
  2. show the plaintext of the service root that is being supplied to each offline store


0 Kudos

This message was moderated.

former_member190800
Contributor
0 Kudos

Sudhakar, I'm going to close this thread, and unify with the thread here:  .  Please see response there.

midhun_vp
Active Contributor
0 Kudos

Is this questions are same:

0 Kudos

Hi Midhun,

My query is almost same. i am also trying the same in android.