The SAP Cloud SDK offers basic functionality that helps with connecting to other systems and services like S/4HANA Cloud or OnPremise edition.
The SDK leverages the existing API of
HttpClient and applies conveniently managed properties, e.g. according to a specific destination configuration.
In the following paragraphs the
HttpClientAccessor API and its usage will be described.
In general an
HttpClient can be instantiated through the
The SAP Cloud SDK itself uses the accessor class for all iternal requests as well.
If the goal is to create a client with properties according to a specific destination, it can be provided as argument:
When using a destination, the configured destination URL will be used as base path for the subsequent requests for
Please note that similar to other Accessor based APIs, the SAP Cloud SDK offers additional methods with "try" prefix to allow for optional VAVR-enhanced API access.
When the properties of
HttpClient are not working for the application, e.g. timeout is too short or too long, then the generation can be customized.
Please find the
HttpClientFactory interface and the provided implementation
They offer a similar method
createHttpClient with optional destination argument:
DefaultHttpClientFactory type offers a static builder, to enable custom properties for:
When inheriting from
DefaultHttpClientFactory it's possible to provide even deeper customization:
It is possible to take advantage of calls to
super - or use your own objects directly.
This inheritance enables custom implementation for the following methods:
Now that the customization of the HTTP client factory is available, the default behavior for the accessor can be adjusted very easily:
From now on the custom factory will be used for every explicit and implicit HTTP request running through the Cloud SDK.