Search code examples
ibm-mobilefirstworklight-adapters

How to call worklight adapter from other adapter


How to call method of one adapter from the method of other adapter?

Suppose, I have two adapters :

1. ReadAdapter that has method ReadFile.

2. CreateAdapter that has method CreateFile

Now I wants to call ReadFile method of ReadAdapter from CreateAdapter's CreateFile method.

Is it possible in Worklight 6.1


Solution

  • Please look at the following presentation which outlines this exact behavior:

    http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v610/04_07_Advanced_adapter_usage_and_mashup.pdf

    Worklight even provides a corresponding sample to compliment the presentation:

    http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v610/AdapterMashUpProject.zip

    The sample above shows a project with multiple adapters with the following structure:

    enter image description here

    The sample even provides code snippets for calling one adapter from another such as:

    enter image description here