Thursday, May 30, 2013

Problematic while calling WebService Data Control in LifeCycleListenerImpl on application start

In this article I wants to share the issue faced while working on sample online/offline data synchronization application. Here I wanted to populate user related data from online to offline database(SQLite db) on application start, so that offline data can be used across the feature. I assumed that it can be done when the ApplicationController initialized by the LifeCycleListenerImpl and call web service data control programmatic way using AdfmfJavaUtilities.invokeDataControlMethod.

I have created the data control in ApplicationController project, since I need to call the web service data control in LifeCycleListenerImpl. My assumption went wrong, I noticed when application run in debug mode, web service data control will not be called at all in LifeCycleListenerImpl. Because AdfmfJavaUtilities.invokeDataControlMethod requires DataBindings.cpx with Data Control Name entry in Data Control Usages section. But DataBindings.cpx will be created in ViewController project.

In one of forum entry as explained by Denis Tyrell and Chris Muir, above approach will not work when we have Secured Web Service, since the login page won't be displayed yet and we won't have the credentials to use for the Web Service.

Sometime you may also hit the error while using AdfmfJavaUtilities.invokeDataControlMethod - "[SEVERE - oracle.adfmf.framework - AmxBindingContext - loadDataControlById] Unable to load Data Control testDataControl due to following error: ERROR [oracle.adfmf.framework.exception.AdfException] - Unable to load definition for testDataControl".

Make sure you have a data control name entry in DataBindings.cpx as shown below.

1 comment:

  1. Nice Post Deepak, I am trying to do the same(calling webservice in LifeCycleListnerImpl). But with datacontrol entry in DataBindings.cpx its still not working.