XPower Meter Read Scanner: Google Cloud Vision Connector on SAP Open Connector Cloud Platform
As SAP is going on an acquisition spree and hosting lot of products and applications on SAP Cloud Platform, clients and SAP development teams and capability leads are often challenged to not only upgrade their skills rapidly but also constantly puzzled on what is the business case for using these new apps and what does it additionally bring to the broad portfolio that organizations already procured and paid.
SAP acquired cloud elements recently and hosted it as open connectors on SAP Cloud Platform. It now not only has 150+ out of the box connectors to different systems but it also provides a very intuitive UI to build our own third party custom connectors on SCP platform. In this blog, we will not only look at when we will use Open Connectors but also the steps required to host the google cloud vision API on SAP Cloud Platform.
Hypothetical Business Scenario
We assume that smart meters are embedded into customer sites with an intelligent #IoT device that takes pictures of meter reads and sends it to SAP Cloud Platform which will then integrate into S4 HANA cloud and SAP backend systems to synchronise the meter reads that will automatically invoice and deduce payment from the customer bank account seamlessly without taking even one second of customer time.
To achieve this, we want to use Google Cloud Vision API as it is a pioneer in industry for image analysis and connect to SAP on-premise and cloud systems. Please note that SAP Leonardo platform also provides API for Image Analysis but we picked google cloud vision to just demonstrate how quickly we can integrate other vendors with SAP cloud and on-premise systems.
The business scenario will challenge us with one interesting question, “As there is no standard connector for google cloud vision and we have to build integration from scratch, which tools I should use to develop i.e SAP API management or SAP CPI or Open Connector”?
We already know that we will use SAP CPI for process orchestration pattern i.e. when we have to orchestrate and fetch or split and map and encrypt data from multiple on premise and cloud systems. Hence it is easy to deduce for anyone that SAP CPI and Open Connectors offerings are complementary.
This narrows down the interesting question a bit, “When would we use just API management and when we would use open connector and when we use both of them” as both of them provide capability to design and develop and document or discover API(S) using a drag and drop UI. Open connectors is used to when we need to paginate/search API(s) consistently or normalize authentication or enhance the functionality of the vendor /SAP API(S) and API management is used when we need to monetize API(S) or apply security verification/traffic policies ( Ex: Verify authentication ,Spiking, Quota, Billing plans etc) or centrally monitor or expose the API(S) across the organization and business partners.
The following table may provide a guideline on when and why you will use Open Connectors to enhance SAP or third party API(S). We want to enable image analysis API to upload/download images in bulk and normalize vendor specific authentication( Supress Google Cloud Vision API key authentication) and use SAP Basic Authentication but want to use Google API quota and monetizing plan and hence our choice was Open Connectors. It took exactly less than an hour to build this connector on SAP Open Connectors platform without any prior skills on this platform.
|Functionality||Open Connector Component||SAP Open Connector|
|Enhance third party API to provide notifications or call back on successful post of data into third party systems||Webhooks||Yes|
|Enhance third party or SAP API(s) to bulk upload data via files||Bulk Upload/Download & Models||Yes|
|Filter the third party or SAP API response or request payload as required by User App||CEQL & Request/Response Hooks||Yes|
|Do you want to enhance third party API to trigger every 5 minutes i.e polling?||Polling Events||Yes|
|Do you want to search i.e filter and paginate API(S) in consistent manner irrespective of whether they are SAP API(S) or third party API(S) and whether the functionality is implemented by SAP/third party or not?||CEQL and Pagination||Yes|
|Do you want to normalize authentication mechanisms of SAP API(S) and third party API(S) i.e use same authentication mechanisms as SAP for third party as well ?||Authentication Types||Yes|
|Do you want to merge data from multiple SAP API(S) and third party API(S) but provide one composite API to the User App?||Formulas||Yes|
|Do you want to create global canonical models and share the data models between different third party/SAP system API(S) especially when you are building your custom API(S)?||Common Resources||Yes|
|Are you on multi cloud environemnt ( i.e on Google/Amazon/Azure/SAP) but want to publish and authenticate all API(S) from SAP Cloud Environment?||N/A||Yes|
Google Cloud Vision Connector
Step 1 : Swagger the Google API in JSON and import into Open Connector as .JSON and only select v1/images : annotate as we only require that method for this blog.
Step 2: In authentication screen, define the cloud vision connector basic authentication
Step 3: In configuration screen we created a API key and defaulted it with my Google Cloud Vision API key by pressing add configuration as we want to normalize authentication of the connector to use Basic Authentication and supress API key authentication required by google.
Step 4: In parameter screen , we need to map the configuration key defined above to pass the default value above as a query parameter to the vendor specific API ( Google Cloud Vision API) automatically.
Please note if we don’t perform step 3 and step 4 then the API will generate following error when you test it:
Step 5 : In resource section, you need to create authentication instance to try out the API as shown below :
We named the instance as “XPower MeterRead AI Scanner” and hence once it is craeted, the screen should look like :
Step 6 : In resource section, let’s test API by pressing try it out button to read the below gas meter reading from the image as shown below
Paste the below JSON in body section and press execute :
Step 7 : Please note the new authentication and google cloud vision open connector API end point and authentication format in the below Curl Code. After you press the execute button, it should provide response as shown below. You can now test Google Cloud Vision API on SAP Open Connectors Cloud Platform using below curl code from postman or web/mobile applications across external and internal applications.
This API can now be bulk enabled and integrated into SAP ECC and SAP S4 HANA cloud for automatic invoicing and payment over SAP CPI app.
Sravya -- wow - cool share! Took only an hour to build this custom connector - awesome data point. Thanks for taking us through the reasoning for using Open Connectors.
One note -- it looks like your images aren't resolving in the blog above - perhaps they're pointing to local storage instead of properly referenced in the cloud. Please have a look? thanks!
Thanks Moya, I think I resolved now.
Excellent! Looks terrific! Thanks again.
Great blog!! Well explained on choosing CPI/Open connector/API Management.
Hello, Do you think it's still possible today?
I'm not sure to understand how you can Swagger the api...