1
votes

We are trying to call OData and REST endpoints in an S/4HANA On Premise system from our SAP Cloud Platform Java app. However, our attempts to use the SAP CloudSDK to get an HTTP client for the corresponding destination

Destination destination = DestinationAccessor.getDestination(destinationName);
HttpClient client = HttpClientAccessor.getHttpClient(destination.asHttp());

fails with the exception

com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationAccessException:
Failed to get on-premise proxy headers.

We are at a loss at what's causing it. The text also isn't very specific about what is missing. "Proxy headers", okay. But what are they, and where do I maintain them, and for what? None of the blogs 1 2 we've referred to mentions anything of the kind.

Our Destination looks as follows:

It points to a Cloud Connector that exposes a back-end system:

  • Host: abc:445
  • Protocol: HTTP
  • Back-End Type: ABAP System

Connection check is successful.

I finally found the piece of code that throws the exception in method getHeadersForOnPremiseSystem of class ConnectivityService in library cloudplatform-connectivity-scp-cf, which apparently fails to resolve headers that are related to the XSUAA service using a PrincipalPropagationStrategy. That makes me wonder: as far as I know, principal propagation is for frontend access to Fiori apps. But we only want to call an OData endpoint, hence neither need nor want to configure that.

What are we missing or doing wrong?

1

1 Answers

2
votes

Florian, you'll have to decorate your destination with DefaultErpHttpDestination like

HttpClient client = HttpClientAccessor.getHttpClient(destination.asHttp().decorate(DefaultErpHttpDestination::new));

Thanks for good feedback, we'll be updating our documentation on destination handling and other OData related topics here