none
WCF Call Progress RRS feed

  • Question

  • Hi
     
    I'm using a 3th-party web service that returns a lot of data, and I need to show the progress while downloading these data.

    I’ve been searching the web for a while, but the only solutions I have found include making changes in both the server and client. But it’s not possible for me to make changes on the server-side.
     
    I have made a similar solution in Delphi. By accessing the lower-level http-response I'm retreiving the total number of bytes that will be transfered, and then get an event that tells you how much data that has been downloaded. 
      
    Is it possible to do something similar in WCF? 
      
    Best regards
    Thomas
    Wednesday, August 13, 2014 6:41 AM

Answers

All replies

  • No, not if you cannot modify anything on the server-side. The client cannot possible know how much work there is left to do on the server-side unless the server provides the client with this information.

    The client simply makes a request to the server and then waits for a response. When the request has been sent from the client, it can just wait. It has no idea of what happens on the server-side and therefore it is impossible for the client to know how long time it will take for the server to generate a response.

    If you had control over both sides (client and server), you could implement a duplex service where both the client and server can send messages to the other independently: http://msdn.microsoft.com/en-us/library/ms731064(v=vs.110).aspx.

    Wednesday, August 13, 2014 7:47 AM
  • Hi

    I'm aware that it's impossible to know how much work is left before the response. But as I stated I just want to show the progress while downloading the data. There should be possible to know how much data that is being transfered.

    So for the user, the progress bar will stop for a while as the server is processing the request, but it will show progress as the data is transfered.

    Wednesday, August 13, 2014 8:32 AM
  • Right, it should be possible provided that the data is streamed from the server to the client, i.e. you must enable streaming: http://msdn.microsoft.com/en-us/library/ms789010(v=vs.110).aspx.

    Please refer to the following page for more information about how you could display the progress of downloading streamed data from a WCF service: http://blog.zwezdin.com/en/38

    Wednesday, August 13, 2014 9:10 AM