Skip to content

Commit 018f593

Browse files
author
Marius Obert
authored
Merge pull request #28 from sbarzaghialteaup/managed-html5-runtime-fiori-cap-service-mta
CAP service to mock the Northwind Product service
2 parents c65c51c + 7776038 commit 018f593

File tree

12 files changed

+461
-1
lines changed

12 files changed

+461
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ In contrast to the examples above, you don't need an application router for the
6868
- [Basic HTML5 App with a Managed Application Router, XSUAA service, and destination service](managed-html5-runtime-basic-mta)
6969
- [SAP Fiori App with a Managed Application Router, XSUAA service, and destination service](managed-html5-runtime-fiori-mta)
7070
71-
71+
### Optional backend service
72+
- [SAP Fiori App example consume a public service, to use instead a CAP service with required authentication look at optional-self-hosted-backend](optional-self-hosted-backend)
7273
7374
# Examples for SAP BTP, Kubernetes Environment
7475

managed-html5-runtime-fiori-mta/readme.md

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ The web app that is contained in the `uimodule.zip` defines the following proper
3131
}
3232
```
3333

34+
35+
> The SAP Fiori app consume the Northwind odata.org public service, to use instead a CAP service with required authentication look at [optional-self-hosted-backend](../optional-self-hosted-backend/)
36+
3437
## Download and Deployment
3538
1. Subscribe to the [launchpad service](https://developers.sap.com/tutorials/cp-portal-cloud-foundry-getting-started.html) if you haven't done so before.
3639
2. Download the source code:
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# CAP cap-service
2+
_out
3+
*.db
4+
connection.properties
5+
default-*.json
6+
gen/
7+
node_modules/
8+
target/
9+
10+
# Web IDE, App Studio
11+
.che/
12+
.gen/
13+
14+
# MTA
15+
*_mta_build_tmp
16+
*.mtar
17+
mta_archives/
18+
19+
# Other
20+
.DS_Store
21+
*.orig
22+
*.log
23+
24+
*.iml
25+
*.flattened-pom.xml
26+
27+
# IDEs
28+
.vscode
29+
.idea
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Getting Started
2+
3+
This is an example of how to consume a CAP service with authentication from on SAP Fiori app.
4+
5+
The [managed-html-runtime-fiori-mta](../managed-html5-runtime-fiori-mta) sample consumes the [Northwind odata.org service](../managed-html5-runtime-fiori-mta/destination.json#L14), this is a public service without any kind of authentication.
6+
7+
This project [mocks](./srv/cat-service.cds#L3) the Northwind service, the service is exposed as a CAP service with required [authentication](./srv/cat-service.cds#L4).
8+
Deploy of this package [override](./mta.yaml#L88) the URL of the original [Northwind](../managed-html5-runtime-fiori-mta/destination.json#L9) destination with the URL of the mockup service and set the property [HTML5.ForwardAuthToken](./mta.yaml#L90) necessary to forward the authentication user from the SAP Fiori app to the CAP service.
9+
This property is documented at [Configure Destinations](https://help.sap.com/viewer/ad4b9f0b14b0458cad9bd27bf435637d/LATEST/en-US/fab4035652cb4fc48503c65dc841d335.html)
10+
11+
The MTA file [bind](./mta.yaml#L35) the CAP service to the xsuaa service already created by the [managed-html5-runtime-fiori-mta](../managed-html5-runtime-fiori-mta/mta.yaml#L74) package.
12+
13+
## Deployment
14+
15+
1. Deploy the `managed-html5-runtime-fiori-mta` to you BTP subaccount as explained in the package documentation
16+
2. Add the entitlement `hana hdi-shared` to your subaccount if you haven't done so before
17+
3. Build the project:
18+
```
19+
mbt build
20+
```
21+
4. Deploy in the same subaccount/space of the `managed-html5-runtime-fiori-mta` package:
22+
```
23+
cf deploy mta_archives/cap-service_1.0.0.mtar
24+
```
25+
## Check the Result
26+
27+
### Check the HTML5 App
28+
To be sure to use the new mock service open an incognito browser window and then access the URL of the HTML5 App of the `managed-html5-runtime-fiori-mta` package, you should see the same data, however the product name of the first product will be *Hello from CAP*, this is the mark that the data are read from the CAP service.
29+
30+
![image](https://user-images.githubusercontent.com/51169423/132773806-f1964c2f-4679-4f7c-988a-a55824729f55.png)
31+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace my.bookshop;
2+
3+
entity Products {
4+
key ProductID: Integer;
5+
ProductName: String;
6+
SupplierID: Integer;
7+
CategoryID: Integer;
8+
QuantityPerUnit: String;
9+
UnitPrice: Decimal;
10+
UnitsInStock: Integer;
11+
UnitsOnOrder: Integer;
12+
ReorderLevel: Integer;
13+
Discontinued: Boolean;
14+
}
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
ProductID;CategoryID;Discontinued;ProductName;QuantityPerUnit;ReorderLevel;SupplierID;UnitPrice;UnitsInStock;UnitsOnOrder
2+
1;1;False;Hello from CAP;10 boxes x 20 bags;10;1;18.0000;39;0
3+
2;1;False;Chang;24 - 12 oz bottles;25;1;19.0000;17;40
4+
3;2;False;Aniseed Syrup;12 - 550 ml bottles;25;1;10.0000;13;70
5+
4;2;False;Chef Anton's Cajun Seasoning;48 - 6 oz jars;0;2;22.0000;53;0
6+
5;2;True;Chef Anton's Gumbo Mix;36 boxes;0;2;21.3500;0;0
7+
6;2;False;Grandma's Boysenberry Spread;12 - 8 oz jars;25;3;25.0000;120;0
8+
7;7;False;Uncle Bob's Organic Dried Pears;12 - 1 lb pkgs.;10;3;30.0000;15;0
9+
8;2;False;Northwoods Cranberry Sauce;12 - 12 oz jars;0;3;40.0000;6;0
10+
9;6;True;Mishi Kobe Niku;18 - 500 g pkgs.;0;4;97.0000;29;0
11+
10;8;False;Ikura;12 - 200 ml jars;0;4;31.0000;31;0
12+
11;4;False;Queso Cabrales;1 kg pkg.;30;5;21.0000;22;30
13+
12;4;False;Queso Manchego La Pastora;10 - 500 g pkgs.;0;5;38.0000;86;0
14+
13;8;False;Konbu;2 kg box;5;6;6.0000;24;0
15+
14;7;False;Tofu;40 - 100 g pkgs.;0;6;23.2500;35;0
16+
15;2;False;Genen Shouyu;24 - 250 ml bottles;5;6;15.5000;39;0
17+
16;3;False;Pavlova;32 - 500 g boxes;10;7;17.4500;29;0
18+
17;6;True;Alice Mutton;20 - 1 kg tins;0;7;39.0000;0;0
19+
18;8;False;Carnarvon Tigers;16 kg pkg.;0;7;62.5000;42;0
20+
19;3;False;Teatime Chocolate Biscuits;10 boxes x 12 pieces;5;8;9.2000;25;0
21+
20;3;False;Sir Rodney's Marmalade;30 gift boxes;0;8;81.0000;40;0
22+
21;3;False;Sir Rodney's Scones;24 pkgs. x 4 pieces;5;8;10.0000;3;40
23+
22;5;False;Gustaf's Knäckebröd;24 - 500 g pkgs.;25;9;21.0000;104;0
24+
23;5;False;Tunnbröd;12 - 250 g pkgs.;25;9;9.0000;61;0
25+
24;1;True;Guaraná Fantástica;12 - 355 ml cans;0;10;4.5000;20;0
26+
25;3;False;NuNuCa Nuß-Nougat-Creme;20 - 450 g glasses;30;11;14.0000;76;0
27+
26;3;False;Gumbär Gummibärchen;100 - 250 g bags;0;11;31.2300;15;0
28+
27;3;False;Schoggi Schokolade;100 - 100 g pieces;30;11;43.9000;49;0
29+
28;7;True;Rössle Sauerkraut;25 - 825 g cans;0;12;45.6000;26;0
30+
29;6;True;Thüringer Rostbratwurst;50 bags x 30 sausgs.;0;12;123.7900;0;0
31+
30;8;False;Nord-Ost Matjeshering;10 - 200 g glasses;15;13;25.8900;10;0
32+
31;4;False;Gorgonzola Telino;12 - 100 g pkgs;20;14;12.5000;0;70
33+
32;4;False;Mascarpone Fabioli;24 - 200 g pkgs.;25;14;32.0000;9;40
34+
33;4;False;Geitost;500 g;20;15;2.5000;112;0
35+
34;1;False;Sasquatch Ale;24 - 12 oz bottles;15;16;14.0000;111;0
36+
35;1;False;Steeleye Stout;24 - 12 oz bottles;15;16;18.0000;20;0
37+
36;8;False;Inlagd Sill;24 - 250 g jars;20;17;19.0000;112;0
38+
37;8;False;Gravad lax;12 - 500 g pkgs.;25;17;26.0000;11;50
39+
38;1;False;Côte de Blaye;12 - 75 cl bottles;15;18;263.5000;17;0
40+
39;1;False;Chartreuse verte;750 cc per bottle;5;18;18.0000;69;0
41+
40;8;False;Boston Crab Meat;24 - 4 oz tins;30;19;18.4000;123;0
42+
41;8;False;Jack's New England Clam Chowder;12 - 12 oz cans;10;19;9.6500;85;0
43+
42;5;True;Singaporean Hokkien Fried Mee;32 - 1 kg pkgs.;0;20;14.0000;26;0
44+
43;1;False;Ipoh Coffee;16 - 500 g tins;25;20;46.0000;17;10
45+
44;2;False;Gula Malacca;20 - 2 kg bags;15;20;19.4500;27;0
46+
45;8;False;Rogede sild;1k pkg.;15;21;9.5000;5;70
47+
46;8;False;Spegesild;4 - 450 g glasses;0;21;12.0000;95;0
48+
47;3;False;Zaanse koeken;10 - 4 oz boxes;0;22;9.5000;36;0
49+
48;3;False;Chocolade;10 pkgs.;25;22;12.7500;15;70
50+
49;3;False;Maxilaku;24 - 50 g pkgs.;15;23;20.0000;10;60
51+
50;3;False;Valkoinen suklaa;12 - 100 g bars;30;23;16.2500;65;0
52+
51;7;False;Manjimup Dried Apples;50 - 300 g pkgs.;10;24;53.0000;20;0
53+
52;5;False;Filo Mix;16 - 2 kg boxes;25;24;7.0000;38;0
54+
53;6;True;Perth Pasties;48 pieces;0;24;32.8000;0;0
55+
54;6;False;Tourtière;16 pies;10;25;7.4500;21;0
56+
55;6;False;Pâté chinois;24 boxes x 2 pies;20;25;24.0000;115;0
57+
56;5;False;Gnocchi di nonna Alice;24 - 250 g pkgs.;30;26;38.0000;21;10
58+
57;5;False;Ravioli Angelo;24 - 250 g pkgs.;20;26;19.5000;36;0
59+
58;8;False;Escargots de Bourgogne;24 pieces;20;27;13.2500;62;0
60+
59;4;False;Raclette Courdavault;5 kg pkg.;0;28;55.0000;79;0
61+
60;4;False;Camembert Pierrot;15 - 300 g rounds;0;28;34.0000;19;0
62+
61;2;False;Sirop d'érable;24 - 500 ml bottles;25;29;28.5000;113;0
63+
62;3;False;Tarte au sucre;48 pies;0;29;49.3000;17;0
64+
63;2;False;Vegie-spread;15 - 625 g jars;5;7;43.9000;24;0
65+
64;5;False;Wimmers gute Semmelknödel;20 bags x 4 pieces;30;12;33.2500;22;80
66+
65;2;False;Louisiana Fiery Hot Pepper Sauce;32 - 8 oz bottles;0;2;21.0500;76;0
67+
66;2;False;Louisiana Hot Spiced Okra;24 - 8 oz jars;20;2;17.0000;4;100
68+
67;1;False;Laughing Lumberjack Lager;24 - 12 oz bottles;10;16;14.0000;52;0
69+
68;3;False;Scottish Longbreads;10 boxes x 8 pieces;15;8;12.5000;6;10
70+
69;4;False;Gudbrandsdalsost;10 kg pkg.;15;15;36.0000;26;0
71+
70;1;False;Outback Lager;24 - 355 ml bottles;30;7;15.0000;15;10
72+
71;4;False;Flotemysost;10 - 500 g pkgs.;0;15;21.5000;26;0
73+
72;4;False;Mozzarella di Giovanni;24 - 200 g pkgs.;0;14;34.8000;14;0
74+
73;8;False;Röd Kaviar;24 - 150 g jars;5;17;15.0000;101;0
75+
74;7;False;Longlife Tofu;5 kg pkg.;5;4;10.0000;4;20
76+
75;1;False;Rhönbräu Klosterbier;24 - 0.5 l bottles;25;12;7.7500;125;0
77+
76;1;False;Lakkalikööri;500 ml;20;23;18.0000;57;0
78+
77;2;False;Original Frankfurter grüne Soße;12 boxes;15;12;13.0000;32;0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
{
2+
"file_suffixes": {
3+
"csv": {
4+
"plugin_name": "com.sap.hana.di.tabledata.source"
5+
},
6+
"hdbafllangprocedure": {
7+
"plugin_name": "com.sap.hana.di.afllangprocedure"
8+
},
9+
"hdbanalyticprivilege": {
10+
"plugin_name": "com.sap.hana.di.analyticprivilege"
11+
},
12+
"hdbcalculationview": {
13+
"plugin_name": "com.sap.hana.di.calculationview"
14+
},
15+
"hdbcollection": {
16+
"plugin_name": "com.sap.hana.di.collection"
17+
},
18+
"hdbconstraint": {
19+
"plugin_name": "com.sap.hana.di.constraint"
20+
},
21+
"hdbdropcreatetable": {
22+
"plugin_name": "com.sap.hana.di.dropcreatetable"
23+
},
24+
"hdbflowgraph": {
25+
"plugin_name": "com.sap.hana.di.flowgraph"
26+
},
27+
"hdbfunction": {
28+
"plugin_name": "com.sap.hana.di.function"
29+
},
30+
"hdbgraphworkspace": {
31+
"plugin_name": "com.sap.hana.di.graphworkspace"
32+
},
33+
"hdbhadoopmrjob": {
34+
"plugin_name": "com.sap.hana.di.virtualfunctionpackage.hadoop"
35+
},
36+
"hdbindex": {
37+
"plugin_name": "com.sap.hana.di.index"
38+
},
39+
"hdblibrary": {
40+
"plugin_name": "com.sap.hana.di.library"
41+
},
42+
"hdbmigrationtable": {
43+
"plugin_name": "com.sap.hana.di.table.migration"
44+
},
45+
"hdbprocedure": {
46+
"plugin_name": "com.sap.hana.di.procedure"
47+
},
48+
"hdbprojectionview": {
49+
"plugin_name": "com.sap.hana.di.projectionview"
50+
},
51+
"hdbprojectionviewconfig": {
52+
"plugin_name": "com.sap.hana.di.projectionview.config"
53+
},
54+
"hdbreptask": {
55+
"plugin_name": "com.sap.hana.di.reptask"
56+
},
57+
"hdbresultcache": {
58+
"plugin_name": "com.sap.hana.di.resultcache"
59+
},
60+
"hdbrole": {
61+
"plugin_name": "com.sap.hana.di.role"
62+
},
63+
"hdbroleconfig": {
64+
"plugin_name": "com.sap.hana.di.role.config"
65+
},
66+
"hdbsearchruleset": {
67+
"plugin_name": "com.sap.hana.di.searchruleset"
68+
},
69+
"hdbsequence": {
70+
"plugin_name": "com.sap.hana.di.sequence"
71+
},
72+
"hdbstatistics": {
73+
"plugin_name": "com.sap.hana.di.statistics"
74+
},
75+
"hdbstructuredprivilege": {
76+
"plugin_name": "com.sap.hana.di.structuredprivilege"
77+
},
78+
"hdbsynonym": {
79+
"plugin_name": "com.sap.hana.di.synonym"
80+
},
81+
"hdbsynonymconfig": {
82+
"plugin_name": "com.sap.hana.di.synonym.config"
83+
},
84+
"hdbsystemversioning": {
85+
"plugin_name": "com.sap.hana.di.systemversioning"
86+
},
87+
"hdbtable": {
88+
"plugin_name": "com.sap.hana.di.table"
89+
},
90+
"hdbtabledata": {
91+
"plugin_name": "com.sap.hana.di.tabledata"
92+
},
93+
"hdbtabletype": {
94+
"plugin_name": "com.sap.hana.di.tabletype"
95+
},
96+
"hdbtrigger": {
97+
"plugin_name": "com.sap.hana.di.trigger"
98+
},
99+
"hdbview": {
100+
"plugin_name": "com.sap.hana.di.view"
101+
},
102+
"hdbvirtualfunction": {
103+
"plugin_name": "com.sap.hana.di.virtualfunction"
104+
},
105+
"hdbvirtualfunctionconfig": {
106+
"plugin_name": "com.sap.hana.di.virtualfunction.config"
107+
},
108+
"hdbvirtualpackagehadoop": {
109+
"plugin_name": "com.sap.hana.di.virtualpackage.hadoop"
110+
},
111+
"hdbvirtualpackagesparksql": {
112+
"plugin_name": "com.sap.hana.di.virtualpackage.sparksql"
113+
},
114+
"hdbvirtualprocedure": {
115+
"plugin_name": "com.sap.hana.di.virtualprocedure"
116+
},
117+
"hdbvirtualprocedureconfig": {
118+
"plugin_name": "com.sap.hana.di.virtualprocedure.config"
119+
},
120+
"hdbvirtualtable": {
121+
"plugin_name": "com.sap.hana.di.virtualtable"
122+
},
123+
"hdbvirtualtableconfig": {
124+
"plugin_name": "com.sap.hana.di.virtualtable.config"
125+
},
126+
"properties": {
127+
"plugin_name": "com.sap.hana.di.tabledata.properties"
128+
},
129+
"tags": {
130+
"plugin_name": "com.sap.hana.di.tabledata.properties"
131+
},
132+
"txt": {
133+
"plugin_name": "com.sap.hana.di.copyonly"
134+
}
135+
}
136+
}

0 commit comments

Comments
 (0)