2 Replies Latest reply on Apr 7, 2010 1:14 PM by saisri2k2

    Best practice on when to call the HTTPService?

    saisri2k2 Level 4

      We use HTTP calls to get data frm the server. Currently in our application we call the server on creationComplete event-and display tabs buttons depending on the data that i get from the server.

       

      But i'm thinking to call the server at initialization event and keep the data ready by the time it comes to creationComplete/what ever works. When is it good to call the server? please update my knowledge.

        • 1. Re: Best practice on when to call the HTTPService?
          Matt Le Fevre Level 4

          i always call HTTPServices on applicationComplete, to avoid the chance of trying to populate something which hasn't been created yet.

          • 2. Re: Best practice on when to call the HTTPService?
            saisri2k2 Level 4

            Ya.. i understand.. but, What i'm thinking is to populte the data into arraycollection / keep the XML which we get and keep it ready for the completion event. Coz, what i see is, whenever i click on a button, it opens a tab on the tabNavigator and shows a canvas without any data - paralell to this a server call is made and after few moments the canvas shows the data, even though it all happens within 2-4 secs depending on the network.. I'm still concerned about those 2-4 secs.. i'm trying to bring down the time it takes to load that single page by running a few things paralelly than doing it one after the other. Any other way you could think of?

             

            Message was edited by: saisri2k2