IBM Worklight 6.1 - HTTP适配器可以在服务器端调用另一个HTTP适配器吗? [英] IBM Worklight 6.1 - Can a HTTP adapter call another HTTP adapter on server-side?

查看:142
本文介绍了IBM Worklight 6.1 - HTTP适配器可以在服务器端调用另一个HTTP适配器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发适用于iPad的worklight 6.1版本的app,并部署了单个适配器,里面有多个程序。现在我从客户端点击适配器并从服务器获得响应。在某处存储该响应并返回到下一个适配器调用以获取该响应的相关数据。

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?

推荐答案

您需要阅读高级适配器使用情况和混搭培训模块,它正在谈论如何链接适配器调用。

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.

这篇关于IBM Worklight 6.1 - HTTP适配器可以在服务器端调用另一个HTTP适配器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆