这是我的service.js,使用Wl.Client.invoke,不知道我缺少哪些文件,我需要wlinit.js还是initoptions.js还是需要安装任何插件

    .factory('loginservice', function(){
    var user;
    return{
           checkvalue:function(settings){
                    user=settings;
                    console.log(user);
                    var invocationData = {
                            adapter : 'sqltest2',
                            procedure : 'checkvalue',
                            parameters : [user.username,user.password]
                                            };
                    WL.Client.invokeProcedure(invocationData,{
                        onSuccess : loginSuccess,
                        onFailure : loginFailure
                                                             });

                    function loginSuccess(result){
                        console.log("Retrieve success" +  JSON.stringify(result));
                        //displayFeeds(result.invocationResult.resultSet);
                                                }

                    function loginFailure(result){
                        console.log("Retrieve failure");
                                                    }

                }

                }
              })

最佳答案

IBM MobileFirst platform 8.0 sqladapter ReferenceError:未定义WL

我假设您正在使用IBM MobileFirst Platform 8.0,必须安装mfpdev-cli和cordova-plugin-mfp,然后使用WLResourceRequest。查看示例:

var resourceRequest = new WLResourceRequest(
    "/adapters/JavaAdapter/users",
    WLResourceRequest.GET
);
var formParams = {"param1": "value1", "param2": "value2"};
resourceRequest.sendFormParameters(formParams);

resourceRequest.send().then(
    onSuccess,
    onFailure
)


WL.Client.invokeProcedure在IBM MobileFirst 8.0中不再使用。

我建议您浏览一下Cordova应用程序中的MobileFirst Foundation开发。看这里:

在基于离子的应用程序中集成MobileFirst Foundation 8.0:https://mobilefirstplatform.ibmcloud.com/blog/2016/07/19/integrating-mobilefirst-foundation-8-in-ionic-based-apps/

将MobileFirst Foundation SDK添加到Cordova应用程序:https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/application-development/sdk/cordova/

来自JavaScript(Cordova,Web)应用程序的资源请求:https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/application-development/resource-request/javascript/

10-08 17:39