I am developing app on worklight 6.1 version for iPad and deployed single adapter which is having multiple procedure inside it. Now I am hitting adapter from client-side and getting response from server. Storing that response somewhere and passing back to the next adapter call for getting related data for that response.
function GetUSERRID(){
var invocationData = {
adapter : 'CORE_ADAPTER',
procedure : 'GetUserRID',
parameters : [ param1, param2 ]
};
WL.Client.invokeProcedure(invocationData,{
onSuccess : GetUserRID,
onFailure : function GetUserRIDFailure(response){ busyInd.hide();console.log("reponse failure "+response);},
});
}
function GetUserRID(response){
var rid = response.invocationResult.RID;
var invocationData = {
adapter : 'CORE_ADAPTER',
procedure : 'GetUserRID_Details',
parameters : [ rid ]
};
WL.Client.invokeProcedure(invocationData,{
onSuccess : ShowDetailsForRID,
onFailure : function GetUserRID_DetailsFailure(response){ busyInd.hide();console.log("reponse failure "+response);},
});
}
In the above code I am making two adapter calls from client. From the first I am getting some data which I am again passing back to next adapter for getting related data.
Can I make a single adapter call on server and that adapter will call another adapter on server with required data as a parameter from first adapter response and process it and return data back to client?
Same as client side just use
WL.Server.invokeProcedure(invocationData,options);
You need to read the "Advanced adapter usage and mashup" training module, which talks exactly about how to "chain adapter invocations".
An example project is available as well in the link above.