Create Custom Open Connector and use it within iflow in SAP Cloud Integration
This post is building upon two great blogs about SAP Open Connectors:
Sven’s blog how to build a custom connector, connecting to an independent service in the internet (https://blogs.sap.com/2020/04/07/sap-cloud-platform-open-connectors-from-soap-to-rest/)
Kris’ blog how to retrieve credentials and other parameters from the Connector Builder into our iflow and call it from Postman (https://blogs.sap.com/2022/05/12/end-to-end-cloud-integration-using-open-connectors/)
The purpose of this blog is to demonstrate how to actually use the custom-developed Open Connector within our iflow.
Calling our Open Connector from an iflow
Let’s assume we have prepared our Calculator Connector as per Sven’s instructions. In the resource, we now have two parameters (integers to be added) and their technical names (so-called Vendor name).
The Connector is tested and it returns results. Important here is the Request URL section.
Now let’s jump into SAP Integration Suite and create a simple iflow.
The Content modifier’s only purpose is to set headers. You can see in the curl query in the above screenshot, that these headers are sent with the actual query. In the Authorization header copy the whole long string ‘User …, Organization …, Element …’
For the Request – reply component, select OpenConnectors adapter.
In the Connection section, fill the URI without query parameters and the resource name (eg. ‘/add’). In the query parameters you have to fill the Vendor name (!), not the actual parameter name, even though the call from the Connector Builder uses the parameter names ‘secondNumber’, ‘firstNumber’.
You have to also fill the credential name, which you can create in Monitor->Integrations
->Create User Credentials
Only then we can run our iflow and we receive the response in the form of the message body.
Calling our Open Connector from Postman
We can as well call our Open Connector service from Postman, using the same authorization header method. This means, that we have to manually fill the header parameters Authorization (again the full string) and Accept.
Notice that we are using the complete URL with the ‘firstNumber’, ‘secondNumber’ parameters, unlike in our iflow!