Integration Server 10.11 | Developing Data Synchronization Solutions with webMethods Mobile Support | Developing Solutions Using Mobile Support | Step 1: Write the Server-Side Business Logic | Writing the Flow Services | Writing the Download Service
 
Writing the Download Service
When writing the download service to return data from the backend application to a mobile device, include the following:
*Include a reference to the wm.mobile.datasync.specs:downloadSpec specification. This specification defines the input and output signatures of the download service.
*Include branching logic to handle the specified amount of backend data to fetch. In the branch step, call the appropriate adapter service to download all data or only certain records according to the value specified in the inputArgs and fetchAll parameters of the wm.mobile.datasync.specs:downloadSpec specification.
In the following example, the download service invokes an adapter service called selectInvSvc to select all inventory records from the backend application when fetchAll is set to “yes.” When fetchAll is set to “no,” the download service invokes an adapter service called getInventory to select a single inventory record from the backend application.
*In the pipeline, map the inputArgs input parameter from the wm.mobile.datasync.specs:downloadSpec specification to the adapter service’s input signature when fetchAll is “no.” Then, map the variables from the fetched data in the adapter service’s output to the corresponding variables in the specification’s outputSyncData output parameter.
In the example described above, the selectInvSvc service does not require input arguments because the service is defined to fetch all inventory records. The getInventory service requires input arguments to specify which record to fetch. In this case, the mapping might look like the following:
In the pipeline input, inputArgs is a document that contains the fields specified in the mobile sync component’s row identifier parameter.
Note:
The document mapped to mDataRow should match the business document type you created in Creating the Business Document Type.