Question Categories HttpUtil Web Services

CharlesIPTI

Active Member
Licensed User
Longtime User
Personally I would diligently search for the correct sub forum to ask my question if they existed example HTTPUtil.

This post got me thinking:::
http://www.basic4ppc.com/forum/basi...s/15324-httputils-rare-problem.html#post86965

I suppose I don't understand the url done sub.. versus the Job done Sub. My calls are single calls to a web service, there's just a lot of them.

Also I find myself adding calls BACK to Activity_Create(False) and in addition to checking for the FirstTime = false, I'm checking if the last list was filled or some similar logic so I can continue my "preload Processing" These multiple calls BACK into Activity_Create. Does this seem to be a valid acceptable solution ??? Doesn't Stuff get destroyed and re created when I do this re-call into Activity_Create() So all of those numbered steps below have what I consider a hack added to their section of the jobDone Sub to get Code Focus BACK into the Activity Main and allow the continued processing.

Was this clever or stupid?

Please ANY & ALL insight is greatly appreciated !!! :sign0137:


B4X:
Sub Activity_Create(FirstTime As Boolean)

#Region------------{ local varaibles }--------------------
#End Region


   HttpUtils.CallbackActivity = "postMain"                        ' "rfCartDataWebService"  Attempt To centralize Web Serv Stuff = FAIL!
   HttpUtils.CallbackJobDoneSub = "JobDone"
   HttpUtils.CallbackUrlDoneSub = "UrlDone"

   

#Region-----------{Initial Cart Start Up Harvests}-----------------------------

'#1      Get Settings from File          
               'localSetTypObj = pickCartSettingsMain.HarvestSettings  Old Style Retire ?? 
               If FirstTime Then
                  m_cartState = pickCartSettingsMain.HarvestCartStateFromFile
               End If

'#2    Get MapLocations Web Service call On Success Fills global mapLocList   
                  Try   
                  
                   If bMapLocationsFound = False Then
                     GetLocMap               
                  End If 

'#3    Get Order Assignments if MapList has been obtained 
                  If mapLocList.Size > 1  AND bOrderAssignmentsComplete = False Then                  
                     FetchOrderAssignments
                  End If 
                              
'#4    lstOrders global starts empty and is filled per content of orderAssignments List from step #3                                      
                  If lstOrders.Size < iOrdAssignmentsSize Then
                           HarvestOrderDataForAll                                                                                                                                       
                  End If 
                  
               Catch
               ' Log  - Local if no wifi to call web service
               'OR Just wrap in Loggin Utility Method To Do both simultaneously.               
               End Try               
            
#End Region




#Region----------------------{ User Interface creation }--------------------------
'#Region------------{ xyz }--------------------#End Region
'----Left   Top   Width   Height-------   ' 1280 x 800Reference



#Region---------------------{  Create header }--------------------
      panHeader.Initialize("")      
      panHeader = uiLogic.InitHeaderBlock(panHeader)      
                        Activity.AddView(panHeader,0%x,0%y,1280dip,80dip)
#End Region                                    



   #Region---------------------{ Create Order Bins }--------------------
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The difference between UrlDone to JobDone is more significant with jobs made of multiple Urls. Even in the case of a single Url job there is a difference. UrlDone is only called for Urls that were successfully downloaded. JobDone is always called.

For single Url jobs it is better to only use JobDone.

About the call to Activity_Create. I do not recommend you to call it yourself. Technically it is fine. However it will only make your code more complicated. You should instead create another sub and call it from Activity_Create and from wherever you are currently calling Activity_Create.
 
Upvote 0

CharlesIPTI

Active Member
Licensed User
Longtime User
Added layers

My Activity_Create is actually calling Subs
and these call the HttpUtil which fortunately has the Job Done automatically called from them.

Its trivial but I'll additionally mention that I call a parser in this process so we ALSO have the start & end element for the parsers being called before we jump back into the JobDone.

The only Difference I see in your suggestion is to add another sub to receive the forward from my jobDone,, This as you see from my structure would still need to again call Activity_Create to continue the processing.

However if I remove all my calls from the Activity_Create to another "Flight Controller" I could have ONE GROUP of StartUp data Harvesters and from their combined success only return once to the Activity_Create to now begin the UI Layout ...


I may make this change once more structure has been addressed. I just wanted to confirm that there is no detriment or dangers in my existing process of retuning to the Activity_Create multiple Times from the individual DataPreLoaders..

Thank you ..
 
Upvote 0
Top