0
votes

pls. is there any idea or suggestion wy call from an SQL adapter to another SQL adapter doesnt work ? i use WL.Server.invokeProcedure.({adapter : "SQL_Adapter",procedure : "procedure name in the another adapter"}). it seems that function doesnt check the existence of the adapter and procedure parameters and work with any arbitrary string even for non-existing adapter/procedure. Result is always undefined object returned from the call

i am using Worklight 6.1.0.01.20140311-2356 on Windows server both adapters works fine and are used regularly from client devices the "server" adapter (MS SQL) is used for push notification and defines event source the "client" adapter (DB2) is normal one.

there is piece of code:

var result = getAllUsersFromSQLPushNotificationAdapter();

if (result){
    WL.Logger.info("test1" + result.isSuccessful); //i got false
    WL.Logger.info("test2" + result.errorMessages); //i got undefined

    WL.Logger.info("test3 " + result.resultSet); //i got undefined
    //result = result["invocationResult"]["resultSet"];

    for (var i = 0; i < result.resultSet.length; i++) {
        //result[i].Category ";
    }

    WL.Logger.info("Number of users: " + result.resultSet.length);
}   

function getAllUsersFromSQLPushNotificationAdapter(){


    return WL.Server.invokeProcedure({
        adapter : "CZU_SQL",
        procedure : "getAllUsers"});    

}

thank you

1

1 Answers

0
votes

Try something like below.In getDataSuccess() get the results and use it.

var invocationData = {
        adapter : 'ADAPTER_NAME',
        procedure : 'PROCEDURE_NAME'    
    };

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

For debugging purpose check the Success and failure function results. if you are not able to call another adapter procedure please post the error from failure function.