How to use adapter inside the application in workl

2019-01-26 02:34发布

Im new to worklight. Now im started using adapter. Check this link one of my stackoverflow friend have same doubt click this Calling the procedure inside the application. The Adapter im using is SqlAdapter. But in the ibm worklight tutorial they gave example for HttpAdapter and clubing the procedure inside the function. But not for SqlAdapter. If any suggestion kindly let me know. if u want to my source i will ready to provide. Still my research continues

2条回答
我只想做你的唯一
2楼-- · 2019-01-26 02:51

The call from an application to an adapter is the same for all types of adapters.

function getData() {
var invocationData = {
        adapter : 'ADAPTER_NAME',
        procedure : 'PROCEDURE_NAME',
        parameters : []
    };

WL.Client.invokeProcedure(invocationData,{
    onSuccess : getDataSuccess,
    onFailure : getDataFailure,
});
}

For more information check module 6 - Invoking Adapter Procedures from the Client Applications (PDF, 370KB) and the exercise and code sample (ZIP, 53.7KB)

查看更多
迷人小祖宗
3楼-- · 2019-01-26 03:14

enter image description here

Here i retrieved the values. but its not displaying in html page. this is my code

function wlCommonInit(){
    // Common initialization code goes here
    WL.Logger.debug("inside the wlcommoninit");
    busyIndicator = new WL.BusyIndicator('AppBody');
    getData();

}






function loadFeedsSuccess(result){
    WL.Logger.debug("Feed retrieve success");

}

function loadFeedsFailure(result){
    WL.Logger.error("Feed retrieve failure");

}


function getData() {
    var invocationData = {
            adapter : 'SqlAdap',
            procedure : 'procedure1',
            parameters : []
        };

    WL.Client.invokeProcedure(invocationData,{
        onSuccess :  loadFeedsSuccess,
        onFailure : loadFeedsFailure,
    });
    }
查看更多
登录 后发表回答