0

We are not able to make a subsequent API call from Java back-end code(cloud s4/sdk. maven tomee arch-type) with principal propagation destination.

Use-Case:

  1. Initial API call is working fine as the request is getting triggered from UI5 via app-router to our java back end,since app-router will get the proper oauth-token (JWT) the identity is propagating to Java back-end code and same passed to S/4Hana system and we are getting back the ODATA response.

  2. When we tried to make a subsequent API call from our Java back-end code we are getting 403(authorization exception). For which we have tried to incorporate JwtBasedRequestContextExecutor class, withJwt (),withXsuaaServiceJwt() we are getting the following error

com.sap.cloud.sdk.cloudplatform.exception.ShouldNotHappenException: Cannot set current context: RequestContext returned by com.sap.cloud.sdk.frameworks.hystrix.HystrixRequestContextFacade already initialized. Have you correctly configured a interface com.sap.cloud.sdk.cloudplatform.servlet.RequestContextFactory?

appreciate if you could help for this usecase.

Bentaye
  • 9,403
  • 5
  • 32
  • 45
  • This error message tells us, that you already have a `RequestContextExecutor` wrapping your code. This can be the one provided by the SDKs `WebFilter` that "intercepts" the incoming request and extracts relevant information. This already seems to work, as you can make your initial call. One potential fix (and encouraged anyway) is to upgrade to version 3 of the SDK. In there we reworked the whole `JwtBasedRequestContextExecutor` which might already fix the problem. See [this guide](https://developers.sap.com/tutorials/s4sdk-migration-v3.html) for details. – Christoph Schubert Nov 15 '19 at 07:29
  • Hi Dinesh, did this already solve your problem? – Christoph Schubert Dec 02 '19 at 07:48

0 Answers0