Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 4 Jahren, 10 Monaten
Letzter Beitrag:
vor 4 Jahren, 10 Monaten
Beteiligte Autoren:
Michael Drechsel, Fabrice Harari, Malc

[WD17] Cancel a webservice call

Startbeitrag von Michael Drechsel am 08.09.2013 13:25


I have a lot of webservices created. If the user choose no filter and the database is big, the call of the webservice can take a while.

Is there any way to allow the user to cancel the webservice ? (Press ESC or something else)


nobody .... ?

von Michael Drechsel - am 11.09.2013 13:15
Hi Michael

I do not see any way to cancel a call to a webservice from the client side... The only idea that coms to mind is to limit the dataset returned on the webservice side, potentially with a flag indicating that there is more to come, so as to allowed the client to either call again for more data, or just used the currently returned dataset...

Best regards

von Fabrice Harari - am 11.09.2013 14:20
Hi Fabrice,

yes, that´s the common way. But I thought we can do anything with threads (call a thread, wait and if its too long, cancel it)

But I didn´t thread programming in the past ...

von Michael Drechsel - am 11.09.2013 14:38
Hi again

that MAY be possible with cancelling a thread. However, that would very likely NOT tell the webservice about the cancellation, which means that it would continue to get the data then try to send it back to something not waiting for it anymore...

So that would not be a solution that I would like to implement, as the load on the server would remain, and I'm not sure what the future communication with the webservice would look like

Best regards

von Fabrice Harari - am 11.09.2013 16:27
Hi Michael

Just some thoughts, assuming the webservices/methods are written by you...

Forget about waiting for a response

Have several web service methods to process the request

First call a method to initialise processing and get a unique process id.
The server continues to process the request after disconnect

The server periodically checks for a cancel request with its process id, which if found ends processing

The client periodically calls another method of the web service with the process id to ask if results are available, or if the request no longer exists (user waited too long to pick up results)

If the client wishes to cancel, call another method of the web service with the process id which flags a cancel request against this id at the server

One the processing at the server completes, the results await the pickup request from the client. There should be a period set for when the results are invalid/out of date and can be scrapped.



von Malc - am 12.09.2013 13:33
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.