在MobileFirst 8中没有调用WL方法

时间:2017-04-10 20:40:47

标签: ibm-mobilefirst mobilefirst-adapters mobilefirst-server

我正在尝试在Mobilefirst 8.0中调用WL worklight方法。但没有一种方法可以调用。我已经尝试了WLResourceRequest,WL.Client.Environment等来调用适配器方法。     代码段:

alert("Calling adapter");                //printed
var url = "/adapters/AdapterNewGet/getFeed1";
var resourceRequest = new WLResourceRequest(url, WLResourceRequest.POST);
alert("Called adapter");                 //Not Printed

此处,alert("Called adapter");未执行。如果我必须包含一些worklight库或需要进行一些设置,请告诉我。

1 个答案:

答案 0 :(得分:0)

var resourceRequest = new WLResourceRequest(url, WLResourceRequest.POST); 

这只会初始化WLResourceRequest对象。您必须致电resourceRequest.send()才能实际呼叫服务器。

alert("Calling adapter");                //printed
var url = "/adapters/AdapterNewGet/getFeed1";
var resourceRequest = new WLResourceRequest(url, WLResourceRequest.POST);

resourceRequest.send().then(onSuccess,onFailure); 
// Move the below line to your onSuccess.
// Add similar error handling in the onFailure
alert("Called adapter");                 //Not Printed