'Batch headers are not considered for individual requests with Cloud sdk 3.66

Ours is a dwc based application Master Data Proxy Service (MDPS).

We are getting an error due to the required Dwc headers (dwc-tenant, dwc-subdomain, dwc-jwt) etc, not being propagated to individual request contexts from a batch request.

I did some debugging on this and here are my observations:

We create a destination with DwcHeaderProvider as header provider with the following code:

DefaultHttpDestination.builder(megacliteUri + MEGACLITE_VERSION + serviceBinding)
            .keyStore(dwcUtil.getKeyStore())
            .keyStorePassword("changeit")
            .proxyType(ProxyType.INTERNET)
            .headerProviders(new DwcHeaderProvider()
            // The destination that Megaclite should use to perform the request
            .header(Constants.DESTINATION_NAME, Constants.DEFAULT_DESTINATION_VALUE)
            .build();

DwcHeaderProvider in turns gets all the relevant headers including the dwc headers. But with the new version its not happening.

I can see that internally the headers are fetched from a headerFacade, which in the previous versions used to be DefaultRequestHeaderFacade. Now the facade is getting initialized as com.sap.cds.integration.cloudsdk.facade.CdsRequestHeaderFacade and this comes from a jar com/sap/cds/cds-integration-cloud-sdk/1.23.0/cds-integration-cloud-sdk-1.23.0.jar

cds-integration-cloud-sdk-1.23.0.jar

Can you look into it this? It is a high prio issue for us, since batch requests are completely not working, and our UI relies on such requests.

Thanks, Sachin



Solution 1:[1]

Update: Please use CAP 1.24 - the issue is fixed already.


Until the problem is solved and a proper fix is released, can you try a workaround?

Before instantiating the destination run the following code snippet:

import com.sap.cloud.sdk.cloudplatform.requestheader.RequestHeaderAccessor;
import com.sap.cloud.sdk.cloudplatform.requestheader.DefaultRequestHeaderFacade;

RequestHeaderAccessor.setHeaderFacade(new DefaultRequestHeaderFacade());

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1