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 NameEnter a service name. Data SourceSelect a source from the drop-down. The available source types are: BTP Destination,Mobile Services,Service URLandLocal File.Mobile Services LandscapeSelect your Mobile Services Landscapefrom the pop-up. This pop-up appears only when you have selectedMobile Servicesas theData Sourcetype. There are three options available for landscape:standard,preview, andneo. The first two options are for the Cloud Foundry environment. If you haveMobile Services Previewedition available in yourCloud Foundryaccount, choosepreview. Chooseneofor the Neo environment.Application IdSelect an application from the pop-up. This pop-up appears only when you have selected Mobile Servicesas theData Sourcetype. This is the application that you've created in mobile services.Service URLEnter the Service URL. This field appears only when you have selectedService URLas theData Sourcetype.DestinationSelect a destination from the drop-down. Local Metadata XMLSelect an XML file from the local files. This field appears only when you have selected Local Fileas theData Sourcetype.Path SuffixAppend a path to your OData service if required. Language URL Paramsap-languageis the default value. However, you can provide a different value.Enable offlineBy default, it's enabled. Select No to disable it. REST ServiceBy default, it's disabled. Select Yes to enable it. Click
Check Serviceto 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
Servicesfolder and the metadata will be stored in the.xmlfile. -
To start working with a service, double-click it or right-click and choose
Open Withand then selectOData Service EditororCode Editor. You can clickSync Serviceto 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.