on 2023 Apr 18 9:51 AM
Hello Colleagues,
We have a SAP Cap Java application in DwC. We have defined a REST Controller and contact a POST Endpoint. The endpoint will be called by another service in DwC with the tenant information in header. In order to correctly process the payload, we would need to set the tenant id in the request context so that the persistence service can be called in the right context. Could you please give some guidance as to how the headers can be mapped to the request context.
Regards,
Aniket
Request clarification before answering.
You can define the tenant when opening the RequestContext in your RestController.
context.getCdsRuntime().requestContext() .modifyUser(u -> u.setTenant(<tenant>)) .run(requestContext -> { // queries will be executed in context of <tenant> persistenceService.run(...); });
See an example here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 18 | |
| 7 | |
| 6 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.