Skip to Content
0

HTTP PUSH API IOT services issue in xsjs

Jan 20, 2017 at 10:23 AM

171

avatar image
Former Member

Hello Techies,

I have been trying to call the HTTP PUSH IoT API to push data to a device.

https://iotmmsxxxxxx.hana.ondemand.com/com.sap.iotservices.mms/v1/api/http/push/58f068e5-eacf-4847-93e2-2c24c555aa74

I tried to send the payload using POSTMAN with Basic Authorization and it works perfectly but when I try to push through a xsjs program, it fails.

Below is the xsjs program code:

var req = new $.web.WebRequest($.net.http.POST, "/58f068e5-eacf-4847-93e2-2c24c555aa74");

var data = JSON.stringify({"method":"http","messageType":"fc93815e9342xxxxxx0","messages":[{"CONTROL":0}]});

req.headers.set("Content-Type","application/json");

req.setBody(data);

client.request(req, dest);

var response = client.getResponse().body.asString();

The XSHTTPDEST file content is as below:

host = "iotmmsxxxxxx.hana.ondemand.com";

port = 8080;

pathPrefix = "/com.sap.iotservices.mms/v1/api/http/push";

proxyType = http;

proxyHost = "proxy";

proxyPort = 8080;

authType = basic;

useSSL = false;

timeout = 30000;

The response is:

While trying to retrieve the URL: http://iotmmsxxxxx.hana.ondemand.com:8000/com.sap.iotservices.mms/v1/api/http/push/58f068e5-eacf-4847-93e2-2xxxxx74 The content could not be delivered due to the following condition: Connection refused Your cache administrator is: markus.stegmueller@sap.com

Is this due to the PORT number that i have used 8000? i have tried changing the port number in the xshttpdest file to 8080 but the error is the same.

Any solution for this would be highly appreciated.

Thanks in Advance.

Srivatsan

postman.jpg (97.3 kB)
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Srivatsan,

Were you able to successfully push the data ? I am trying to create a device from rdms api using xsjs code.. I am getting status code 200 but the device is not created in cockpit.

Thanks!

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Anton Levin
Jan 20, 2017 at 10:40 AM
0

Hello Srivatsan, "iotmms" is running and accessible under HTTPS with the default secure port 443. You have your xs http destination configured to access it via HTTP and port 8080. This will not work. Please, find a similar discussion in archive [1]. There is also an example for the destination. Regards, Anton

[1] https://archive.sap.com/discussions/thread/3944545

Share
10 |10000 characters needed characters left characters exceeded