klashagelqvist
klashagelqvist

Reputation: 1261

WebService with progress bar

Writing a client application that sends images to a server via a webservice. As the amount of data can be large i have a need for a progressbar that shows the progress. Can someone point me in the right direction on how to hook into the webservice so i can show the progress in the client.

Upvotes: 1

Views: 1795

Answers (3)

Philipp Schmid
Philipp Schmid

Reputation: 5828

One idea would be the following:

  1. Call the web service as normal.
  2. Web service returns immediately providing a unique identifier (e.g., id or GUID). The web service continues to process the request (asynchronously). Occasionally it will update a status location (e.g., DB field) with progress update.
  3. The client calls a second web service providing the identifier as a parameter. This second web service then provides the current status. One of the status messages is 'complete'.
  4. The client continues to poll for status updates until the 'complete' message is returned.
  5. Upon receiving the 'complete' message, the client is calling a third web service to retrieve the final result (providing the identifier).

Upvotes: 1

Wiktor Zychla
Wiktor Zychla

Reputation: 48230

One of the possible approaches involves splitting the file into smaller chunks, uploading them chunk-by-chunk with separate service calls which allows you to show the progress.

A small drawback is that you have to put all the chunks into the big file at the server side when the last one gets there.

Upvotes: 0

gosukiwi
gosukiwi

Reputation: 1575

When you have to send a lot of data and you don't have threads, an easy way to get a progress bar is splitting the data in smaller chunks, and send them one by one, that way you know the progress, of course, the service must be able to join the pieces together afterwards.

Upvotes: 3

Related Questions