Create Services¶
A service file defines a destination pointing to an OData or REST backend. After you create your new Mobile Development Kit project, a Services
folder with your .service
file and .xml
file is automatically created under your project. The .xml
file contains the metadata definitions if the service file is pointing to an OData service.
Prerequisites¶
You must have a valid Mobile Development Kit project.
Procedure¶
-
Under your newly created project, right-click the Services folder and click
MDK: New Service
. -
In the Service wizard:
Field Description Name
Enter a service name. Data Source
Select a source from the drop-down. The available source types are: BTP Destination
,Mobile Services
,Service URL
andLocal File
.Mobile Services Landscape
Select your Mobile Services Landscape
from the pop-up. This pop-up appears only when you have selectedMobile Services
as theData Source
type. There are three options available for landscape:standard
,preview
, andneo
. The first two options are for the Cloud Foundry environment. If you haveMobile Services Preview
edition available in yourCloud Foundry
account, choosepreview
. Chooseneo
for the Neo environment.Application Id
Select an application from the pop-up. This pop-up appears only when you have selected Mobile Services
as theData Source
type. This is the application that you've created in mobile services.Service URL
Enter the Service URL
. This field appears only when you have selectedService URL
as theData Source
type.Destination
Select a destination from the drop-down. Local Metadata XML
Select an XML file from the local files. This field appears only when you have selected Local File
as theData Source
type.Path Suffix
Append a path to your OData service if required. Language URL Param
sap-language
is the default value. However, you can provide a different value.Enable offline
By default, it's enabled. Select No to disable it. REST Service
By default, it's disabled. Select Yes to enable it. Click
Check Service
to fetch the metadata from the destination, and the data will be shown in the right side table. -
Choose
Finish
.A new service is created under the
Services
folder and the metadata will be stored in the.xml
file. -
To start working with a service, double-click it or right-click and choose
Open With
and then selectOData Service Editor
orCode Editor
. You can clickSync Service
to fetch the metadata from the destination.
Note
If you are not logged in to Cloud Foundry, Cloud Foundry Sign In page will be appear. You can use the following methods to sign in:
-
Credentials
Enter your username and password. Click
Sign in
. Select Cloud Foundry Organization and Space. If the login attempt fails, you will not be able to use Mobile Services Data Sources. -
SSO Passcode
Click the link to open a new browser page, choose to generate a temporary authentication code, copy the SSO Passcode and paste it back in the Cloud Foundry Sign In page.
Changes made in the service editor simultaneously appear in the code editor.
OData Service Editor¶
The OData Service Editor
view contains other options for your service:
- Headers
- Service Options
- CSDL Options
- Store Parameters
Code Editor¶
The Code Editor
view displays the codes for your metadata elements. As you add or modify contents in the OData Service Editor
, the changes simultaneously reflect in the Code Editor
.