on 2021 Jan 05 6:02 PM
Hello CAP and B1 Experts,
I'm helping a SAP B1 Customer to develop a customer portal using the Service Layer. The Service Layer is consumed using CAP. What we've discovered now is that the Service Layer needs quite some time (aproximately 5 seconds) to authenticate the user. After the authentication a Cookie is set to have a session. But it seems that CAP or the SAP CP Cloud Foundry destination service isn't storing this session cookie and so every new request runs through the B1 Service Layer authentication. We've confirmed this by calling the service layer locally with Postman. There the first two reqeusts take about 5 seconds. The 3rd requests returns in 20 ms.
We've already checked the tips in:
2607373 - Service Layer (SL) Troubleshooting Guide
and even installed the Service Layer on a separate system with a lot of RAM (over 16 GB).
Best regards
Gregor
Hi Gregor,
As you find out there are 2 options for B1 Service Layer authentication:
1. Send a login command that will generate a cookie. Then use this cookie in subsequent requests.
In this case the login is just done once per user session (the session will end after an inactivity default timeout of 30mins that can be customized, login needs to be requested again only after the timeout). Subsequent requests providing the cookie will get faster answers as no login is required.
2. Directly use Basic Authentication for each request you sent. In this case login is not required and neither do cookies. On each request the login credentials need to be checked and login to be done.
As you noticed when using case 1 requests are handled faster as in case 2 the login is done for each request.
Our recommendation is to use then option 1 by taking care of the cookies. In this case the login is done only the first time the login takes place and subsequent requests are faster. Would be good to understand from CAPs team if there could be an option to get that cookie stored.
Nevertheless I cannot explain why it takes so long (5 seconds) in your system. Are you testing with B1 version 10 or 9.3? Performances have been improved in version 10. My recommendation if you have already checked the 2607373 - Service Layer (SL) Troubleshooting Guide is to create a support incident so they can check your deployment configuration.
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,
thank you for your detailed answer. As we want to use the B1 Service Layer from the SAP Cloud Platform Cloud Foundry we've are using option 2. In the Destination that is configured we've maintained a user for basic authentication. I use that option also for SAP S/4HANA or SAP ERP and never had any issues with calls taking that long due to authentication. We clearly see that the delay is caused by the authentication. Because when we do a call in Postman with empty cookies it takes arount 5 seconds. The 3rd requests returns in 20 ms.
I don't see option 1 really as an alternative as there I would have to configure the Destination without a user and store the user credentials as a user provided service. That has the effect that all developers in my subaccount also can see the credentials. The second drawback is the 30 minute timeout. I need to implement a fallback handler that would catch authentication errors cased by the timeout and then do a fresh login.
I hope this issue can be tackeled at it's root cause which is the long lasting authentication.
Best regards
Gregor
User | Count |
---|---|
82 | |
12 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.