cloud-sdk-java icon indicating copy to clipboard operation
cloud-sdk-java copied to clipboard

Removing sap-client property from detination and setting it manually results in HTTP 400 for OnPremise system requests

Open AnnaLbr opened this issue 1 year ago • 2 comments

Issue Description

Hello, recently we have been removing the sap-client property from the destination via DefaultHttpDestination.fromDestination(<some-destination>).removeProperty("sap-client").
We are aware that OnPremise systems need this property, so we are setting it manually for each request as query parameter and as header.

To our surprise, all requests to OnPremise systems faild with status 400.
We were startled by this behavior and did not expect it at all. As per this cloud sdk docu, the sap-client header is set automatically if it is present on the destination. Nothing else is mentioned here. But there must be another difference.

I have debugged into this to see what this different is - please see the screenshots:

Header of request with Cloud sdk sap-client header: DebugWithCloudSDK

Header of request setting sap-client header manually: DebugNoCloudSDK

Differences I noticed:

  1. sap-client is of type org.apache.http.message.BasicHeader (set manually) and com.sap.cloud.sdk.cloudplatform.connectivity.Header (loud sdk default logic)
  2. Header Proxy-Authorization and SAP-Connectivity-SCC-Location_ID is duplicate for setting header manually, but with the same values

Do you have any idea what else could be going wrong here? Does the cloud-sdk do any additional stuff, other than setting the header?

Impact / Priority

Changing this header logic led to massive issues on our customers side, we had to revert to code and are now analyzing the root issue. However, we dont understand the difference with these two apporaches.

Applicaiton Logs

There is very little application logging. All requests to OnPremise systems simply returned with status 400. No other meaningful massage. Sending requests to the system works with postman.

Maven Dependency tree

mvn-dependency-tree.txt

Project Details

com.sap.cloud.sdk sdk-bom : 5.11.0

  • Project type: Java App
  • Platform:
    • [X] Cloud Foundry

Checklist

  • [x] Checked out the documentation and Stack Overflow
  • [x] Description provided with all relevant information
  • [x] Exception and stack trace provided
  • [ ] Attached debug logs
  • [x] Attached dependency tree
  • [x] Provided Cloud SDK version & link to relevant source code

AnnaLbr avatar Aug 19 '24 07:08 AnnaLbr

Hi Anna, sorry you ran into this. This is something I was afraid might happen when discussing the "removeProperty" approach. The problem is that this currently leads to duplicate headers. Now, some systems ignore that, but it seems the cloud connector is more strict and doesn't allow this, even when header values are the same.

We'll look into a workaround / fix.

MatKuhr avatar Aug 19 '24 08:08 MatKuhr

Hi again! Thanks for letting me know, so quick as well 😊 Understanding the issue is important for now. We do not need to merge these changes soon.

Feel free to update me if you have a workaroud/fix.

AnnaLbr avatar Aug 19 '24 08:08 AnnaLbr

Hi @AnnaLbr, glad to let you know this has been fixed with version 5.12.0. Please let us know if something doesn't work as expected 😉

MatKuhr avatar Sep 03 '24 15:09 MatKuhr

@MatKuhr Thanks a lot, that didnt take long at all 😊 I will let you know in cases of issues

AnnaLbr avatar Sep 04 '24 06:09 AnnaLbr