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-applicatio...
Hi all,
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 .
This was a good first working demo but I didn't like the use of the Java servlet. Therefore I've searched and found a way to
push messages from javascript (UI5) in the WebIDE to the IoT services without a Java Servlet .
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:
https://iotmmsp935700trial.hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api
URL for iotrdms:
https://iotrdmsiotservices-p935700trial.hanatrial.ondemand.com/com.sap.iotservices.dms/v1/api
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
- Messages
- response function
- error function
5. Result
Now I can control my HANA car from my WebIDE project.
No need for a Java Servlet :smile:
Good luck!
Kind regards,
Wouter