The new version of SAP Cloud SDK is here! All 3 major SDK components received significant updates. In this post, we’ll guide you through key improvements, highlights, and updates path. Feel free to jump directly to the respective component’s section:
SAP Cloud SDK for Java 3.27.0
A new and customizable HttpClient factory
Some applications that use the SAP Cloud SDK may require very specific properties on their HTTP client connection. Wth the latest release it is possible to easily adjust the
DefaultHttpClientFactory instance, that is exposed through
HttpClientAccessor. Changes that happen in this API also affect the internal requests through the SAP Cloud SDK.
Within a few lines of code the custom properties can be established, like time-out duration and maximum number of concurrent connections. Alternatively the application developer can provide their very own implementation by inheriting from the existing factory class and overriding the specific accessors.
A quick modification of default values can be achieved by using the builder pattern API:
HttpClientFactory factory = DefaultHttpClientFactory.builder() .timeoutMilliseconds(60000) .maxConnectionsPerRoute(100) .maxConnectionsTotal(200) .build(); HttpClientAccessor.setHttpClientFactory(factory);
At any point of the application runtime the application may call this accessor implicitly or explicitly:
HttpClient httpClient = HttpClientAccessor.getHttpClient();
When a destination was used to call the accessor it would look like this:
HttpDestination destination = DestinationAccessor.getDestination("MyDestination").asHttp(); HttpClient httpClient = HttpClientAccessor.getHttpClient(destination);
For more details on what’s changed refer to the release notes.
How to update?
Navigate to a root folder of your project and find a
pom.xml file. Bump the version of
com.sap.cloud.sdk dependency to
3.26.0 similar to the XML code snippet below and you’re done! Mind, because of Maven Central relying on CDN it takes a bit of time for new maven module to be distributed.
<dependencyManagement> <dependencies> <dependency> <groupId>com.sap.cloud.sdk</groupId> <artifactId>sdk-bom</artifactId> <version>3.27.0</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> <!-- possibly further managed dependencies ... --> </dependencyManagement>
If for some reason your IDE hasn’t fetched updated dependency version, run
mvn clean install from the command line in the root directory of your project.
Experimental OData v4 client gets new features released
With the latest release, we provided support for
enum types. Check the code snippet below on how to use it.
TestEntity.builder() .enumProperty(TestEnumType.Member1) .build()
For previously unsupported edm types like
Edm.Geography, we introduced a type called
Edm.Any, so that these properties are not ignored. However, type safe features like url conversion are not supported.
- Special characters like
ä(umlaut) are encoded properly when used in the
- When both destination and the custom request config contain
authorizationheaders, a warning is logged with the information about which one is used.
How to update?
npm update in the root folder of your module. Note that this will also update other modules unless you explicitly specify which packages to update. If you want to check beforehand what will change, use
Additionally, you can consult NPM for more information on version history and update path.
SAP Cloud SDK for Continuous Delivery
In this release, we have removed the option to specify an NPM registry specifically for packages by SAP (scope
@sap). This is no longer required, as all packages by SAP are now available from the standard public NPM registry. You can safely remove the configuration option
How to update?
If you are using the pipeline with a fixed version (as recommended since v7), update the continuous delivery toolkit with the following command, that you run on the server hosting the cx-server:
./cx-server update image
We hope you enjoy developing with SAP Cloud SDK! To help us further improve give your ideas and suggestions in the comments to this blog or send them to email@example.com.
All the best,
SAP Cloud SDK Team