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 SapCloudPlatformEndpoint 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 Required
Headers object Optional
LanguageURLParam string Optional
OfflineEnabled boolean Optional true
OfflineOptions object Optional
OnlineOptions object Optional
PathSuffix string Optional
ServiceUrl string Required

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 will be merged into 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 neo-app.json file:

e.g.

"headerWhiteList": ["APIKey"]

Please refer to below link for more informtation

https://help.sap.com/viewer/ea72206b834e4ace9cd834feed6c0e09/Cloud/en-US/df89d9cd06a84905a3a4747f102c5b2c.html

  • 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 Optional
CSDLOptions CSDLOptions Optional
StoreParameters StoreParameters Optional

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 Optional
CSDLOptions CSDLOptions Optional

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

ServiceUrl

URL to the OData service (deprecated). Service URL will now be taken from the SAPCloudPlatformEndpoint 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"
    ]
  }
}

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"
}