My apologies in advance if I've overlooked an obvious answer.
I want to create Worklight adapters that communicate to Dojo widgets using JSON and REST rather than using invokeProcedure(). Some Dojo widgets handle JSON natively and I think this will make my app more maintainable and let me push more logic into the adapter. Furthermore, I'd like the option to have other UIs (like full Objective C apps) to communicate with the adapter.
What's the best way to do this? Can it be done?
This topic has been locked.
Pinned topic WL Adapter as JSON, REST Server
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Re: WL Adapter as JSON, REST Server2012-12-06T05:49:22ZThis is the accepted answer. This is the accepted answer.There are two ways to call adapters that I'm aware of:
1. Using invokeProcedure()
2. Using the URL:
Where localhost is the server running the Worklight Server, customers is the adapter name, getCustomers is the procedure name and parameters are any parameters you want to pass to the procedure.
Taken from my post here: http://www.ibm.com/developerworks/forums/message.jspa?messageID=14893550#14893550
I'm not sure about your dojo specific questions, but if you can't use invokeProcedure or the URL you probably can't do it with Adapters.
Eric Durocher 270002J65538 Posts
Re: WL Adapter as JSON, REST Server2012-12-06T09:16:50ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
I am not sure what the Dojo side of the question is, but as general guidelines, as soon as the WL adapter returns JSON data, you can use the appropriate Dojo data store to plug that data to any Dojo data-aware widget:
- If the widget supports "old-style" dojo/data stores, you can use either a simple dojo/data/ItemFileReadStore or more advanced stores like dojox/data/QueryReadStore or dojox/data/JsonRestStore
- If the widget supports "new-tyle" dojo/store, you can use a dojo/store/JsonRest store.
If you are using Dojo Mobile widgets, there are variants that support both stores (old a new), so you should go for new (e.g. EdgeToEdgeStoreList + dojo/store/JsonRest). You will find examples of this on dojox/mobile/tests (test_EdgeToEdgeStoreList.html, etc).
Hope that answers the question...?