Skip to Content
avatar image
Former Member

Unable to call RDMS API through Destination

Hi,

I am trying to access the devicetypes of IoT using the API which I need to do in one of my projects (there are several other things to be done, but this is the first step).

I am stuck as I am getting the following error while calling the API through destination -

HttpClient.request: request failed: internal error occurred "Failed to send request to socket...rc = -1"

I have one destination file with extension "xshttpdest" whose contents are below -

description = "get all devices";
host = "https://iotrdmsiotservices-xxxxxxxxxxtrial.hanatrial.ondemand.com";
port = 443;
pathPrefix = "/com.sap.iotservices.dms/v2/api/deviceTypes";
proxyType = none;
proxyHost = "";
proxyPort = 0;
authType = none;
useSSL = false;
timeout = 9999;

To access this destination and to get the data from API, I have below xsjs file:

var dest = $.net.http.readDestination("folder", "destinationname");
var client = new $.net.http.Client();
var req = new $.net.http.Request($.net.http.GET,"");
req.contentType = "application/json;charset=utf-8";
client.request(req, dest);
var response = client.getResponse();
$.response.contentType = "application/json";

Had been trying to figure out what the error is from quite sometime now but cannot figure out what the problem is.If anyone has done this before, pls help me out.

Thanks a lot in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Apr 26, 2017 at 08:03 PM

    Hi,

    You'll have to set the proxy settings in the xshttpdest file as described here: https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/2eb13e1217a74561af5950e006fd1e36.html

    Best regards

    Daniel

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 27, 2017 at 05:14 AM

    Please, see similar setup discussed in here https://answers.sap.com/questions/109312/http-push-api-iot-services-issue-in-xsjs.html (there is also one link to archive in comments).

    P.S. Please, use search functionality of the Community before posting.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 08, 2017 at 04:35 PM

    If you are using the HCP trial instance by any chance, then you need to use the proxy for sure. I had a similar issue with the simple job scheduling example with the yahoo stock ticker and did not realize the proxy needs to be in place for using HTTP destinations through HCP.

    useProxy = true;
    proxyHost = “proxy-trial”;
    proxyPort = 8080;

    Add comment
    10|10000 characters needed characters exceeded