Skip to content

Service

This is a .service file that defines an OData Service destination. The DestinationName property is used as the suffix to the ServerUrl URL when queries are made using this service.

A service can run in an online or offline mode.

To configure a service for online mode, set the OfflineEnabled in the .service file to false. In this case, the MDK client communicates directly with the OData service. You can configure your apps to perform reads and updates to synchronize the client data.

To configure a service for offline mode, set the OfflineEnabled in the .service file to true. In this case, the MDK client communicates with the OData service via the offline OData provider. You can configure your apps to initialize a data store and synchronize it with the OData service.

Service Properties

Property Type Required Default
DestinationName string Yes
Headers object No
LanguageURLParam string No
OfflineEnabled boolean No true
OfflineOptions object No
OnlineOptions object No
PathSuffix string No
RestService boolean No false
ServiceUrl string Yes

DestinationName

The destination name of the OData service in the Mobile Services

  • type: string

Headers

Custom headers to be included in all OData requests for the service in key/value pair format. If additional custom headers are defined in an OData action or an OData function in ClientAPI, the service headers merge to the custom headers in the OData action or OData function in ClientAPI.

If you are deploying the WebClient App on the NEO environment and you need additional HTTP headers to be forwarded to or from a backend request or backend response, add the header names in the following format to the Config.js file:

e.g.

"headerWhiteList": ["APIKey"]

For more information, see this.

  • type: object

LanguageURLParam

Indicates if this service can accept requests with language parameter

  • type: string

OfflineEnabled

Indicates if this service runs in offline mode. This is set to false for WebClient.

  • type: boolean
  • default: true

OfflineOptions

Additional options for the service if OfflineEnabled is set to true.

  • type: object with following properties.
Property Type Required Default
ServiceOptions OfflineServiceOptions No
CSDLOptions CSDLOptions No
StoreParameters StoreParameters No

ServiceOptions

Offline options for interaction with a data service.

CSDLOptions

Options for CSDL Parser

StoreParameters

Offline store OData parameters


OnlineOptions

Additional options for the service if OfflineEnabled is set to false.

  • type: object with following properties.
Property Type Required Default
ServiceOptions OnlineServiceOptions No
CSDLOptions CSDLOptions No

ServiceOptions

Online options for interaction with a data service.

CSDLOptions

Options for CSDL Parser


PathSuffix

The path suffix that will be appended to the DestinationName and used to initialize the Online Service or Offline store. If OfflineEnabled is set to true, then you must also set OfflineOptions > StoreParameters > StoreName.

  • type: string

RestService

Indicates whether this service is a REST service.

  • type: boolean
  • default: false

ServiceUrl

URL to the OData service (deprecated). Service URL will now be taken from the ServerUrl in brandedSettings.json or overrides.json or Onboarding URL.

  • type: string

Examples

Service with LanguageURLParam & Headers

{
  "DestinationName": "Northwind",
  "OfflineEnabled": true,
  "LanguageURLParam": "sap-language",
  "Headers": {
    "Accept-Language": "/MyMDKApp/Rules/GetLanguage.js"
  }
}

Service with PathSuffix

{
  "DestinationName":"Northwind",
  "PathSuffix":"/V3/OData/OData.svc",
  "OfflineEnabled": true,
  "OfflineOptions": {
    "StoreParameters": {
      "StoreName": "NorthwindV3"
    }
  }
}

Offline Service With CSDL Options and Store Parameters

{
  "DestinationName":"Northwind",
  "OfflineEnabled": true,
  "OfflineOptions": {
    "ServiceOptions": {
      "supportsBind": false,
      "supportsPatch": false,
    },
    "CSDLOptions": [
      "allowCaseConflicts",
      "defaultVariableScale",
      "defaultVariableSrid",
      "disableFacetWarnings",
      "disableLoggingOfErrors",
      "disableLoggingOfWarnings",
      "disableNameValidation",
      "excludeServerOnlyElements",
      "failIfProviderIncompatible",
      "ignoreAllAnnotations",
      "ignoreAllReferences",
      "ignoreEdmAnnotations",
      "ignoreExternalReferences",
      "ignoreInternalReferences",
      "ignoreStandardReferences",
      "ignoreUndefinedTerms",
      "ignoreXmlAnnotations",
      "logWithUnqualifiedFileNames",
      "processMixedVersions",
      "resolveUndefinedTerms",
      "retainOriginalText",
      "retainResolvedText",
      "traceParsingOfElements",
      "strictFacetWarnings",
      "warnAboutUndefinedTerms",
      "warnIfProviderIncompatible"
    ],
    "StoreParameters": {
      "EnableIndividualErrorArchiveDeletion": true,
      "EnableRepeatableRequests": true
    }
  }
}

Online Service with Service Options & CSDL Options

{
  "DestinationName":"Northwind",
  "OfflineEnabled": false,
  "OnlineOptions": {
    "ServiceOptions": {
      "avoidInPaths": "test",
      "cacheMetadata": false,
      "checkQueries": false,
      "checkResults": false,
      "checkVersion": false,
      "dataFormat": 1,
      "dataVersion": 0,
      "databaseOnly": false,
      "fixMissingEmptyLists": false,
      "fixMissingNullValues": false,
      "logErrors": false,
      "logWarnings": false,
      "metadataFile": "test",
      "metadataText": "test",
      "metadataURL": "/Test/$metadata",
      "pingAccept": "application/json",
      "pingMethod": "GET",
      "pingResource": "/",
      "requiresToken": "X-CSRF-Token",
      "requiresType": false,
      "supportsAlias": false,
      "supportsBatch": false,
      "supportsBind": false,
      "supportsDelta": false,
      "supportsNext": false,
      "supportsPatch": false,
      "supportsUnbind": false,
      "statefulService": false
    },
    "CSDLOptions": [
      "allowCaseConflicts",
      "defaultVariableScale",
      "defaultVariableSrid",
      "disableFacetWarnings",
      "disableLoggingOfErrors",
      "disableLoggingOfWarnings",
      "disableNameValidation",
      "excludeServerOnlyElements",
      "failIfProviderIncompatible",
      "ignoreAllAnnotations",
      "ignoreAllReferences",
      "ignoreEdmAnnotations",
      "ignoreExternalReferences",
      "ignoreInternalReferences",
      "ignoreStandardReferences",
      "ignoreUndefinedTerms",
      "ignoreXmlAnnotations",
      "logWithUnqualifiedFileNames",
      "processMixedVersions",
      "resolveUndefinedTerms",
      "retainOriginalText",
      "retainResolvedText",
      "traceParsingOfElements",
      "strictFacetWarnings",
      "warnAboutUndefinedTerms",
      "warnIfProviderIncompatible"
    ]
  }
}

Rest Service

OfflineEnabled must be set to false when RestService is true

{
  "DestinationName":"Northwind",
  "OfflineEnabled": false,
  "RestService": true
}

ServiceUrl (Deprecated)

If DestinationName is not specified, the destination name will be taken from the ServiceUrl property. This is done by taking the last path component from the URL.

{
  "ServiceUrl":"https://mobile-w00070145a18.eu2.hana.ondemand.com/com.sap.sam.swa",
  "OfflineEnabled": true,
  "LanguageURLParam": "sap-language"
}