Communicate with IoT in your WebIDE project
This blog is outdated. HAT will no longer support the described functionality. There is now an alternative feature in SAP Web IDE Full-Stack called “IoT Enablement”. You can refer to the blog post here: https://blogs.sap.com/2018/01/15/how-to-build-an-iot-app-on-top-of-sap-cloud-platform-iot-application-enablement/
I recently posted blogs about the HANA Car: HCP IoT HANA Car v1.0 . The HANA Car is connected to IoT on HCP. To control the car I’ve created a Java Web application with a Java Servlet and UI5 web part as described here: HANA Car v1.0 – Java Webapp .
Follow the next step to communicate from your WebIDE project with the IoT service:
1. Create the destination for the IoT service in you HCP cockpit
The URL for iotmms:
URL for iotrdms:
2. Inject Internet of Things API library
Open your UI5 project in the WebIDE. Go to the folder where you want to implement the IoT library. Right click and click on “Inject Internet of Things API library”
You’ll now have a new file “IOT.js” in the folder where you’ve added the library.
Change the namespace of the IOT library to the namespace of your project:
3. Configure neo-app.json
Configure the destination of iotmms in the neo-app.json. The following configuration will redirect every request to iotmms. It will also replace “iotmms” to “http”.
4. Use the IOT library
Include the library in your controller:
Call the function “pushData” and pass the following parameters:
- Device ID
- Method (“http” or “ws”)
- Sender name ( you can choose this, I used “HANA Car Control”)
- Messagetype ID
- response function
- error function
Now I can control my HANA car from my WebIDE project. No need for a Java Servlet 🙂