Show TOC

Offline OData Plugin OverviewLocate this document in the navigation structure

The Offline OData plugin provides offline OData support to Kapsel applications. OData version 2.0 (OData V2) is supported. The plugin is supported for use with applications on the Android and iOS platforms.

The plugin provides the client with the ability to define offline stores for an OData producer. When an offline store is first opened, it synchronizes with the OData producer. OData requests made against this plugin use the available open offline stores.

The plugin uses the OData component from the SAP Mobile Platform SDK.

Custom OData httpclient

The Offline OData plugin provides a OData httpclient based on datajs, a cross-browser JavaScript library. The httpclient resolves requests with the Offline OData plugin if the service root of the request matches one of the open stores. The httpclient defaults to using the original OData.defaultHttpClient if the requests service root does not match any of the currently open stores.

You must explicitly apply the custom httpclient in the JavaScript.

sap.OData.applyHttpClient();
OData Requests outside datajs

An OData request may be made directly with an XMLHttpRequest, or a library other than datajs may be used. For these cases, you must use the sap.OData.request method to perform the request. This method is used by the custom httpclient, which can be used as a reference.

Flushing Offline Outbound Queue

You must explicitly call the flush method on a store to send modifications to the OData producter. Events are provided in the JavaScript for when a flush starts, error occurs, and flush ends.

Refreshing Data

You must explicitly refresh your stores to get changes from the OData producer. The plugin provides a refresh method that you can call to refresh the whole store or a subset of it.

Error Recovery

The event onrequesterror is fired if a request fails against the OData producer.

You can provide detailed information about errors through the ErrorArchive. The ErrorArchive logs business logic errors and ETag mismatch errors. You can configure an offline application to access the ErrorArchive so that end users can read and delete logged errors. See Designing an Offline Application to Handle Conflicts and Errors in Developer < Native OData Application Development.