You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open the file `mtad.yaml` that you created in the previous Tutorial [Create a Simple OData Service with Mobile Back-End Tools](cp-mobile-backend-tools-simple-odata).
44
44
45
-
In the application's **requires** section, after `- name: MbtEpmDemoService-xsuaa` (line 20), add another line with
45
+
In the application's **requires** section, after `- name: MbtEpmDemoService-xsuaa` (line 27), add another line with
4. To further allow deployments with `cf push` or `csdl-to-war`, also reference the destination service instance in `manifest.yml` by adding the instance name to the **services** of your application (last line only) as in the reference below:
131
+
4. To further allow deployments with `cf push` or `csdl-to-war`, also reference the destination service instance in `manifest.yml` by adding the instance name to the **services** of your application and deleting the placeholder as in the reference below:
### Annotate your entities for data load from source system
143
167
144
-
145
168
1. Open your `metadata.csdl.xml` with text editor.
146
169
147
170
2. Add `edmx` references to the declarations in the first lines - you will need three additional namespaces to be available for the cache database: *SQL*, *Cache* and *HTTP*.
8. You can now access the data from source system via your cached OData service by executing the URL from approuter, as in the last step of the previous tutorial of this mission. The data can be accessed by appending either `BusinessPartnerSet` or `SalesOrderSet` to the URL.
283
306
284
307
>The URL should look like the following: `https://[your-org]-[your-space]-mbtepmdemoservice-approuter.cfapps.[landscape-host].hana.ondemand.com/BusinessPartnerSet`
285
-
- If you experience any issues on querying the data, please try to sort them out first before continuing with the next step. After the next step it will become much more difficult.
286
-
- The service should return corresponding data from the source system and render it in a simple table. You can use standard OData query parameters to restrict the returned data.
308
+
- If you experience any issues on querying the data, please try to sort them out first before continuing with the next step. After the next step it will become much more difficult.
309
+
- The service should return corresponding data from the source system and render it in a simple table. You may use standard OData query parameters to restrict the returned data.
287
310
288
311
### Add Client-Filter and Client-Registration entities to customise a download query
1. If not noted down previously, find the application route (URL) assigned to the app router in the space of SAP Business Technology Platform Cockpit and click it
565
+
1. If not noted down previously, find the application route (URL) assigned to the app router in the space of SAP Business Technology Platform Cockpit and click it
566
+
567
+
- 
543
568
544
-

569
+
- A new browser tab will open, showing the service document
545
570
546
-
- A new browser tab will open, showing the service document
571
+

547
572
548
-

573
+
2. Call `/BusinessPartnerSet` or `SalesOrderSet` and notice an error that the `Client-Instance-ID` header is missing.
549
574
550
-
2. Call `/BusinessPartnerSet` or `SalesOrderSet` and notice an error that the `Client-Instance-ID` header is missing.
575
+
>Due to the custom download query incorporating the `BusinessPartnerFilter`, you can only query this data set if you registered to the service and sent your `Client-Instance-ID` header representing your registration. Without a filter uploaded, you will still see an empty response.
551
576
552
-
>Due to the custom download query incorporating the `BusinessPartnerFilter`, you can only query this data set if you registered to the service and sent your `Client-Instance-ID` header representing your registration. Without a filter uploaded, you will still see an empty response.
553
-
>You can perform such a [Client Registration](https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/getting-started/mbt/client-registrations.html#registration-header) also in a REST client, while the recommended approach would be to use a mobile application that automates this procedure.
577
+
>You may perform such a [Client Registration](https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/getting-started/mbt/client-registrations.html#registration-header) also in a REST client, while the typical approach would be to use a mobile application that automates this procedure.
@@ -223,32 +226,41 @@ The command creates a blank metadata file for you that you can now open and edit
223
226
# [h2db]
224
227
# destination-service
225
228
# [no-destinations]
229
+
# xsuaa-service
230
+
# [no-xsuaa-service]
226
231
```
232
+
227
233
>When inserting snippets to YAML files, pay attention to the indentation of the lines, as YAML is indentation-sensitive. Before pasting, make sure that your cursor is set to beginning of an empty line.
228
234
229
235
>**Hint:** You can indent multiple line back or forward by selecting them and pressing **(Shift + TAB)** or **(TAB)** on your keyboard.
230
236
231
237
8. Select **Terminal** → **Run Task** and select the task `csdl-to-war` to generate, deploy and run the service to your space. You can observe in the Terminal if the run was successful.
232
238
233
-

239
+

240
+
241
+
**Congratulations!** You just deployed an OData service. You can find out the application route using `cf apps` in Terminal or through BTP Cockpit and open the URL in e.g. in your browser.
242
+

234
243
235
-
9. (Optional) If you want your service to load test data, you can switch `TEST_MODE` to `true`. Therefore you execute task `csdl-to-war-test` or edit the variable in file `TestSettings.java` from your workspace at the path `srv` → `src` → `main` → `java` → `com` → `sap` → `mbtepmdemo` → `TestSettings.java`.
244
+
>At this point you created an OData service that you can already use for prototyping, development etc. Keep in mind that data is not persistent when using MBT with H2 database. In the next step you will learn how to implement authentication, which might not be necessary for pure testing purposes.
236
245
237
-
You can also edit the generated test data inside the folder `srv` → `src` → `main` → `resources` → `test-data`. The test data is stored in the `.json` files. You will have to re-run the build task `csdl-to-war` again to reflect this change.
246
+
9. (Optional) If you want your service to load test data, you may switch `TEST_MODE` to `true`. Therefore you execute task `csdl-to-war-test` or edit the variable in file `TestSettings.java` from your workspace at the path `srv` → `src` → `main` → `java` → `com` → `sap` → `mbtepmdemo` → `TestSettings.java`.
247
+
248
+
You might want to edit the generated test data inside the folder `srv` → `src` → `main` → `resources` → `test-data`. The test data is stored in the `.json` files. You will have to re-run the build task `csdl-to-war` again to reflect this change.
249
+
250
+
There is also the possibility to include initial data which will be loaded on every fresh database initialization, for non-testing scenarios.
238
251
239
252

240
253
241
254
>In case you struggle on generating the service, you might find the [documentation](https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/getting-started/mbt/generating.html) helpful.
242
255
243
-
**At this point you created an OData service that you can already use for prototyping, development etc. In the next step you will learn how to implement authentication, which might not be necessary for pure testing purposes.**
244
256
245
257
### Configure authentication and app router
246
258
247
259
If the service shall be accessible independently and authentication is required, an Authorization and Trust Management Service (XSUAA) service binding as well as an app router will be required for your OData service. If you are looking for more details of this service, you might want to go through [Secure a Basic Node.js App with the Authorization and Trust Management Service (XSUAA)](cp-cf-security-xsuaa-create) tutorial and its references, already covering the same for another application type.
248
260
249
-
1. Open the file ``tasks.json`` from folder ``.vscode`` and uncomment the line `"-login", "XSUAA",` in the configurations `csdl-to-war` and `csdl-to-war-nodeploy` as shown below.
261
+
1. Open the file ``tasks.json`` from folder ``.vscode`` and uncomment the lines `"-login", "XSUAA",` and `"-xsuaa", "<xsuaa-instance-name>",` in the configurations `csdl-to-war` and `csdl-to-war-nodeploy` as shown below. Thereby replace `<xsuaa-instance-name>` with `MbtEpmDemoService-xsuaa`.
250
262
251
-
>Sometimes it may happen that, due to automatic formatting in SAP Business Application Studio, comments may have been removed from `tasks.json` file. You can try to restore them with **Undo** [CMD] / [CNTRL] + [Z]. Alternatively, recreate the file or add the parameters `"-login", "XSUAA",` manually. Take care of the parameter order, as some parameters are interpreted as a pair, key (prefixed with "-") and value.
263
+
>Sometimes it may happen that, due to automatic formatting in SAP Business Application Studio, comments may have been removed from `tasks.json` file. You can try to restore them with **Undo** [CMD] / [CTRL] + [Z]. Alternatively, recreate the file or add the parameters `"-login", "XSUAA",` manually. Take care of the parameter order, as some parameters are interpreted as a pair, key (prefixed with "-") and value.
252
264
253
265

254
266
@@ -288,16 +300,19 @@ If the service shall be accessible independently and authentication is required,
288
300
289
301

290
302
291
-
5. Finally, the XSUAA service binding need to be reflected for deployment. You can achieve this by adding them to the ``manifest.yml`` that was generated in your workspace.
303
+
5. Finally, verify the XSUAA service binding in `manifest.yml` that should have been updated in your workspace. The tools leverages specific comments for parsing and recreating the file.
292
304
293
-
- To bind the XSUAA service instance, add the following lines:
305
+
- The end section of the file should have been updated to contain:
294
306
295
307
```YAML
296
-
services:
297
308
- MbtEpmDemoService-xsuaa
298
309
```
299
310
300
-
>**Important:** Do not execute the ``csdl-to-war`` tasks anymore. First we need to create the service instances via the Multi-Target-Archive. When they are created, you can work with ``csdl-to-war`` again in order to push just the OData service. This will be quicker than deploying the full MTA.
311
+
- Under certain circumstances, it might happen that the `# services:` section is not automatically uncommented. Therefore, please uncomment it in case.
312
+
313
+
- The placeholder comment `# xsuaa-service` marks the following line to be overwritten with the name given in the task. By removing the placeholder, you may disable this feature.
314
+
315
+
>**Important:** Do not execute the `csdl-to-war` task anymore but stick to `-nodeploy`. First it's necessary to create the service instances via the Multi-Target-Application archive. When they are created, you may work with `csdl-to-war` again in order to push the OData service only. This will be quicker than deploying the full MTA.
301
316
302
317
For reference check the full `manifest.yml` file content.
303
318
@@ -317,19 +332,22 @@ If the service shall be accessible independently and authentication is required,
# provide default-url to be re-used for the app router's destination
@@ -404,16 +430,16 @@ If the service shall be accessible independently and authentication is required,
404
430
405
431

406
432
407
-
>Take note: If you created your Cloud Foundry environment in a `-00x`-environment (like e.g. `us10-001`, currently used in SAP BTP Trial by default), you might receive the error `"The redirect_uri has an invalid domain"`. If this is the case, you will have to allow-list your application uri in the `xs-security.json` file and re-run `cf deploy`.
433
+
>Take note: If you created your Cloud Foundry environment in a `-00x`-environment (like e.g. `us10-001` or `eu10-004`), you might receive the error `"The redirect_uri has an invalid domain"`. If this is the case, you will have to allow-list your application uri in the `xs-security.json` file and re-run `cf deploy`.
0 commit comments