Integration Server 10.5 | Developing Data Synchronization Solutions with webMethods Mobile Support | Developing Solutions Using Mobile Support | Step 3: Write the Mobile Application | Writing the Logic to Initiate Synchronization Requests
 
Writing the Logic to Initiate Synchronization Requests
If the mobile device is intended to send as well as receive data, your mobile application should include logic to do the following:
*Upload changed data from the device to the backend application.
*Download any data from the backend application that has changed since the mobile application last submitted a synchronization request.
Include the following:
*Ensure that the structure of the data to be passed to the sync method matches the format specified in RowStructure. Within the RowStructure class, invoke the setDataRow method to identify the business data, and invoke the setUniqueId method to set the unique ID for the business data.
*Invoke the sync method from the com.softwareag.mobile.data.sync.DataSynchronization class. As input to this method, pass the mobile sync component alias and the RowStructure parameters containing the business data to be synchronized. You can obtain the mobile sync component alias from the business integration developer who created the mobile sync component.
Note:
If you are using a filter in the download method to specify subsets of data to download from the backend application, the Mobile Support Client uses the same filter to process the sync method. If you change the filter key or value, you must invoke the download method again to refresh the device’s local database before you invoke the sync method.
*The com.softwareag.mobile.data.sync.ResponseSet class encapsulates the response from the synchronization request. This class includes responses for all records sent from the mobile application, as well as updated records from the server (filtered, if a filter was supplied with the request). Use the getRowStructures and getStatus methods in this class to process the response further.
Mobile Support returns the following status codes:
Status Code
Meaning
30
An error occurred in the configuration or state of the mobile sync component associated with the mobile application.
To resolve this error, work with the server administrator to ensure that the association between the mobile application version and the mobile sync component is valid and that the mobile sync component is enabled. If appropriate for your business need, have the mobile application provide the user with feedback about the error and instructions for resubmitting the data.
31
The mobile application passed a filter with the request, and a filter validation error occurred.
To resolve this error, ensure that the mobile application passes the expected number of filter keys and that the filter key names match those specified in the mobile sync component’s filter definition.
40
Mobile Support processed the synchronization request successfully.
Overwrite the data in the mobile device’s local database with the new data received from the server.
Note:
Overwrite the mobile device’s local database only when the server returns a status code of 40.
50
Mobile Support encountered an internal error while processing the synchronization request.
Work with the server administrator to resolve this error. If appropriate for your business need, have the mobile application provide the user with feedback about the error and instructions for resubmitting the data.
*Invoke any of the other methods in the Mobile Support Client library as needed for your business needs. For details on these methods, see webMethods Mobile Support Client Java API Reference.