Abhishek swaraj
Abhishek swaraj

Reputation: 11

IBM Worklight - Unable to invoke adapter procedure from client application

I am trying to invoke an adapter procedure from client application. The adapter procedure is working on isolated mode, but it is showing error when invoking it from application.

This is my JavaScript file:

function wlCommonInit(){
    try{
        WL.Client.invokeProcedure({
            adapter : 'userDB',
            procedure : 'getUser',
            parameter : ['demo', 'demo']
        }, {
            onSuccess : function(res){alert("login Success");},
            onFailure : function(res){alert("login Failure");},
        });
    }
    catch(e)
    {
        alert("ERROR::"+e);
    }
}

I am simply put my code in easy way to show my actual error for easy understanding ,this is showing error of catch block:

ERROR::error:invalid invocation of method WL.Client.invokeProcedure;invalid option attribute 'parameter',...

Upvotes: 1

Views: 1190

Answers (1)

Nathan H
Nathan H

Reputation: 49371

Like the error message implies, the option attribute parameter is invalid. It should be parameters, with an S.

function wlCommonInit(){
try{
WL.Client.invokeProcedure({
    adapter : 'userDB',
    procedure : 'getUser',
    parameters : ['demo', 'demo']
}, {
    onSuccess : function(res){alert("login Success");},
    onFailure : function(res){alert("login Failure");},
    });
}
catch(e)
{
    alert("ERROR::"+e);
}
}

Upvotes: 4

Related Questions