0

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

Community
  • 1
  • 1
RED.Skull
  • 1,696
  • 3
  • 24
  • 49

2 Answers2

3

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)

Raanan Avidor
  • 3,533
  • 4
  • 25
  • 32
  • Atlast i can able to retrieve values from db . that was displaying in console. now the problem i dont knw how to retrieve the values into html page – RED.Skull Jul 26 '12 at 05:50
  • I've answered that question on http://stackoverflow.com/questions/11611058/how-to-make-https-requests-with-serverside-javascript-using-worklight – Raanan Avidor Jul 31 '12 at 16:33
1

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,
    });
    }
RED.Skull
  • 1,696
  • 3
  • 24
  • 49
  • In the picture attached you see the results received from the server. And in the console you see that you got to the loadFeedsSuccess function (the "Feed retrieve success" message). Now all you have to do is work with the JSON object you received in the function loadFeedsSuccess (try something like WL.Logger.debug(result.resultSet[0].des) for example). – Raanan Avidor Jul 26 '12 at 07:52
  • 1
    @ravidor i cant able to vote. because my reputation is too low. if my reputation is increased sure i will vote for u – RED.Skull Jul 31 '12 at 06:42