Intel XDK - Error when trying to consume Web Service from Explore Services panel

317 views Asked by At

I am running Ubuntu 15.04 and when I try to call any web service from the Intel XDK -> Explore Services panel the response is something like:

undefined is not a function
TypeError: undefined is not a function at intel.xdk.services.iodocs_.exports.bindCommon (http://127.0.0.1:58889/http-services/api-explorer/iodocs/api-request-common.js:60:14)
at http://127.0.0.1:58889/http-services/api-explorer/iodocs/tryit?functionName=tryIt1433289861198&apiName=db_core&isDebug=true&code=intel.xdk.services.tryIt1433289861198+%3D+intel.xdk.services.iodocs_.bindCommon.bind%28null%2C+%22intel.xdk.services.tryIt1433289

I have been trying to figure out what is happening but I have no clue!

1

There are 1 answers

0
AudioBubble On

This error can be caused by the fact that you did not specify a function to build the URL of the call you're making through the Intel XDK.

Considering the default structure created by intel XDK when you try to use a web service, you should have something like below in your js file.

(function (credentials, helpers) {
  var exports = {};

  exports.YourMethodName = function(params) {
    var url = 'YourURLWithoutParameters' 
    if (params) url = url + '?' + $.param(params);
    return $.ajax({url: url, type: 'GET'});
  };
 
  return exports;
})