tags:

views:

35

answers:

1

Hi All,

I am developing an app which requires interaction with a SOAP web service, to retreive and display data. Now in the application, multiple view controllers have the possibility of calling different methods, of the web service to retreive some data.

I tried to write a common class to handle all the web service related stuff, but was unsuccessfull. The problem I am facing is as mentioned below:

I call the common class method, which has web service handling methods, from a view controller with required parameters. The common class hits the web service, parses the data and returns me the result. I receive the result and use it in my view controller. The problem here is that view controller's execution doesn't wait for the completion of execution of common class's all the delegate methods. That is my view would for exapmle navigate, without waiting for the result from the common class.

Anyone solved this problem??Hoping to get a reply soon. Thanks.

+1  A: 

Create a protocol for your view controllers to conform to, for callbacks when the data is retrieved. The view controller implementation will refresh display as appropriate. You can present a spinner while waiting; it is best to use the status bar activity indicator to show that this is network activity.

Paul Lynch
sorry I couldn't mark your answer as solution earlier. Creating a protocol seems to be the most logical way of doing this.
Vin