How can i call adapter from another worklight proj

2019-07-29 04:39发布

Is it possible that invoking adapter from separate application? Is there any example for this?

2条回答
做自己的国王
2楼-- · 2019-07-29 04:51

The Nathan answer is perfect. But I'd like to emphasize that from Worklight point view a project represents a configuration unit, so I cannot see any benefits of separating adapters from application in two different projects. On other hands, I can understand that could be 2 projects hosted in two different server that should share the same adapter. Even if it is technically possible, I think that the adapter is not intended to become a reusable service across different worklight instances as a kind of AJAX ESB.

查看更多
贼婆χ
3楼-- · 2019-07-29 05:06

Do you mean separate application within the same worklight project? Or a different worklight project?

If same Worklight project, then yes, the scope of an adapter is on the entire project.

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".

For example, try with your browser to go to http://my-host-name:port/project-name/invoke?adapter=myadapter&procedure=myprocedure.

You could then make an AJAX call to this procedure, or call it from an adapter using invokeHttp.

In any case, you will loose some of the built-in features of the Worklight client, such as authentication handling.

查看更多
登录 后发表回答