cancel
Showing results for 
Search instead for 
Did you mean: 

Access an IoT Service on HANA Trial from HANA Trial HTML5 App

marcus_schiffer
Active Participant
0 Kudos

Hi,

we are trying to call a HANA IoT Post service e.g. https://iotmms<user>.hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api/http/data/<device>

However, this does not work for us. After following a description in

  (here the push to device is described) .

when using the the sap.service.IOT.post of the IOT helper code in WEBIDE we get errors of type:

MLHttpRequest cannot load https://iotmms<user>.hanatrial.ondemand.com/com.sap.iotservices.mms/v1/api/http/data/<device>. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://fill-s0002907416trial.dispatcher.hanatrial.ondemand.com' is therefore not allowed access. The response had HTTP status code 401

Although there are some blogs stating that you cannot connect from a local HANATRIAL website to the local HANATRIAL .xsodata services, we wonder whether there is a way for the IoT services to be called locally on the trial landscape.

Accepted Solutions (1)

Accepted Solutions (1)

anton_levin
Active Contributor
0 Kudos

Hi Marcus,

as far as I understood you use that "IOT.js" helper library that you "injected" in WebIDE like described for example here [1]? Did you configure your destinations as well? Communication is supposed to be done via destinations otherwise you will face those CORS problems.

Regards,

Anton

[1]

marcus_schiffer
Active Participant
0 Kudos

Hi Anton,

after all I got the posting to the IOT services working.

It was somewhat tedious to get the right ingrediences from the different tutorials:

  • Getting the destination settings in neo_app.json and on HANA trial
  • Authorization and  the Bearer token in the post request
  • Using the IoT.js functions

Answers (0)