如何从另一个worklight项目中调用适配器? [英] How can i call adapter from another worklight project?
问题描述
是否可以从单独的应用程序调用适配器?有没有这方面的例子?
Is it possible that invoking adapter from separate application? Is there any example for this?
推荐答案
您的意思是在同一个工作灯项目中单独申请吗?或者一个不同的工作灯项目?
Do you mean separate application within the same worklight project? Or a different worklight project?
如果是同一个Worklight项目,那么是,适配器的范围在整个项目上。
If same Worklight project, then yes, the scope of an adapter is on the entire project.
如果是另一个项目,理想情况下你不会。但是,适配器仍然是一个可以手动调用的简单HTTP服务。找到过程调用的正确URL(请参阅 http://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/topic/com.ibm.worklight.dev.doc/devref/c_adapter_invocation_service.html ),或者右键单击eclipse中的过程并选择Invoke procedure。
If a different project, ideally you would not. However an adapter is still a simple HTTP service that you could potentially call manually. Find the correct URL for your procedure call (see http://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/topic/com.ibm.worklight.dev.doc/devref/c_adapter_invocation_service.html), or by right-clicking on the procedure in eclipse and select "Invoke procedure".
例如,尝试使用浏览器转到 http://我的主机名:port / project-name / invoke?adapter = myadapter& procedure = myprocedure
。
For example, try with your browser to go to http://my-host-name:port/project-name/invoke?adapter=myadapter&procedure=myprocedure
.
然后你可以制作一个AJAX调用此过程,或使用invokeHttp从适配器调用它。
You could then make an AJAX call to this procedure, or call it from an adapter using invokeHttp.
在任何情况下,您都将失去Worklight客户端的一些内置功能,例如身份验证处理。
In any case, you will loose some of the built-in features of the Worklight client, such as authentication handling.
这篇关于如何从另一个worklight项目中调用适配器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!