Keep calling web service till it is fullfilled

0
Hi, I am calling a web service which actually times out after 5 secs if the network is slow. The timeout option in the widget does not help.  So, I was thinking to call web service in the background and save data in DB. Can I achieve this? I need to call the service again if it fails and finally once it is fulfilled successfully, I need to stop calling and commit the result in DB. How can I achieve this?   Note: I am chasing a deadline so any help is highly appreciated. Thanks!
asked
2 answers
1

Hi Manish,

From your question it's not entirely clear to me what widget you're working with?

Either way, if you want to store the results of the webservice in the database in the end and you don't need the results on your screen right away you could use the Process Queue module from the appstore:

https://appstore.home.mendix.com/link/app/393/

With this you can configure a task which will retry several times. When it is finally succesfull you could automatically create a new task for the follow up action.

If you want to be more in control of starttime, amount of retries etc, you could create you're own scheduled task module very easily. Just create an extra module with a scheduled event which picks up a task object every 30 seconds for example. For this task you set up a few settings, status(for example open, failed, done), amount of retries etc. To this task entity you connect the entity which you use to send to the webservice. You define the maximum amount of retries and you let it retry every 30 seconds. As soon as it is succesfull you can let it create the follow up task quite easely as well.

Hope this helps. Kind Regards,

Corné

answered
0

Manish,

Another way I have done this is in the microflow to use Custom Without Rollback error handling on the web service call.  Then I can retry the call as many times as I wish.  Just be sure to have a counter so that you don't wind up with an infinite loop.  I've included a screen shot below:

Hope that helps,

Mike

answered