on 2020 Mar 19 8:49 AM
Hello,
I would like to know if there is a possibility to connect SAPUI5 Apps directly to the Service Layer? We are looking for a solution deployable to HANA 1.0 On-Premise and in the future also to HANA 2
We were able to login and perform normal ajax requests, but it would be nice to be able to use OData v4 SAPUI5 models and smart controls with direct connection to the Service Layer’s OData v4.
Our problem with that is, so far, that we are unable to force the app to send SL session cookies together with it‘s http requests that are automatically generated after the OData model binding is done. In a simple ajax call we can force it to send the cookies via xhrFields: {"withCredentials": "true"} setting, but we haven‘t found any option to do that for the SAPUI5 odata v4 model and therefore we are always unauthorized.
Is there any solution to this issue? Preferably one that does not involve something like xsjs proxy, we would like to avoid deploying anything else on the HANA Server, except the SAPUI5 application.
Thank You,
Ondřej Nekvinda
Request clarification before answering.
- On Odata V2, you could specify custom headers upon the model creation.
- On Odata V4, this method isn't available. However, the documentation shows how to update the header of a model(see #changeHttpHeaders). You can use this approach to set the header 'Cookies' with the content provided by SL /Login response.
Overall this is quite ok if you just want to show B1 data on a HTML page, without any custom business logic (ui logic is fine).
That not being the case. I.e, you are building a solution that will communicate with SL, it should be better to revaluate your architecture decisions. Business Logic should not be placed on client side code (UI5/Javascript). So, the SL interactions are handled by the server (See here example with HANA 1.0).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With https://github.com/SAP/openui5/commit/f1443cd35e2b85a933a6b532256ea22c047d22b1 we introduced the experimental parameter withCredentials at the v4.ODataModel. See also https://github.com/SAP/openui5/issues/2129#issuecomment-1651122414.
Hi Ondrej,
Last year we also prepared an exercise around SAPUI5 connecting directly to SL.
The main exercise document HandsOn_SCP_Instructions.pdf is connecting to API Hub but there is another document Connect with B1 Backend Instead of API HUB.pdf you can see the steps to connect with a SL destination instead.
Let me know if you have questions about it.
Regards,
Trinidad.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Trinidad,
Hope all is well with you.
I have the trial account, Web IDE and cloud platform andI tried to follow the instructions in HandsOn_SCP_Instructions.pdf carefully.
I got as far as page 17 and tried to run the app but it failled and showed these messages in the right corner.
Starting module "/mta_B1SL_Summit2018/mta-b1sl-summit2018-approuter".
Could not run module "/mta_B1SL_SUMMIT_2018F/mta-b1sl-summit-2018f-approuter".
Do you have any suggestions to get past this?
Thanks,
Mel Dodd
Hi Ondrej,
SAPUI5 does support oData v4 since a bit more than a year now.
There is one template adapted to oData v4 called “SAP Fioi Worklist
Application OData V4”. With this template you can see the SAPUI5 app
connects automatically with B1 SL via API Hub or a SL destination. I tried
it yesterday and I was able to easily create an application directly connecting to Service Layer.
WebIDE is still available as a direct link for trial
accounts https://cockpit.hanatrial.ondemand.com/cockpit/#/home/trial and you can use it to generate your SAPUI5/Fiori applications and check how the SAPUI5 models and binding is done with SL oData v4.
Let me know if this helps you build your application against SL.
Regards,
Trinidad.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.