Skip to Content
Jun 30, 2022 at 07:24 AM

SAP Cloud SDK Javascript: destinationObjects from destination-Service incompatible

252 Views Last edit Jun 30, 2022 at 08:07 PM 3 rev

Hi Community,

I'm developing a SAP CAP Service on BTP. This uses a REST-service of a third-party-application.
I want to use destination service of BTP for storing connectivity details (url, authentication method) and for storing credentials independet of my btp service.

So my btp services connects to the bound destination-service and gets the desired destination from it.
It returns the destiination-data which contains the stored configuration for that destination.

The returned object for a destination looks link this:


What you can see here is, that all (except my own experimental property myProp) start with an uppercase letter. And as you can see for property 'ProxyType" the further definition seems camelcase. And the property URL is only uppercase.

SAP Cloud SDK has the advantage to create a request based on a destination object. So my thought was, that this destination object has the same strucure as the destination configuration in destination service.
BUT this seems not to be the case..!!

When i tried to connect with that destination object above with SAP Cloud SDKs Method 'executeHttpRequest' in the following way, i get an exception:.

var oResult = await executeHttpRequest (destinationObj, 
  { url : sRelativeUrlToService, header : aHeaders})
The exception says: Property 'url' of destination input must not be undefined.

if i now add one line it works for this simple case with no authentication.

destinationObj.url = destinationObj.URL;
var oResult = await executeHttpRequest (destinationObj,
  { url : sRelativeUrlToService, header : aHeaders})

Any ideas why this is the case and maybe how to transform the destination from destination-service to the form Cloud-SDK expects.

kind regards