Async Webservice, State and progress.

J

Jonathan

Hello all,

I don't have too much experience developing webservices, specially the async
side of it, but i'm trying to develop an (web)app that needs an async call to
a webservice.

I'm trying to have a ASP.NET page, that calls a webservice, and refreshes
itself to show the current progress/status of the webservice. (eg. a
progress-bar)

Reading through this page
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scalenethowto08.asp)
has helped a lot, as it describes exactly what i need, except for the part
that i need to poll for a current status as well.

Does anybody know how/where to implement such a poll in that sample, as i
can't figure out where and how i'd put it.
(I've been reading through just about every page i can find about the
subject, but haven't been able to find anything that sheds some light).

TIA.
 
M

Mujtaba Syed

Hi Jonathan:

If you have a web method called XXX (retval XXX (params)), WSDL.exe will
generate three corresponding methods in the proxy:

* retval XXX (params)
* IAsyncResult BeginXXX (params)
* retval EndXXX (IAsyncResult)

Now the first one is the sync call while the second and the third form the
async call. For an async call, you can call BeginXXX, then go and do
something else, and comeback to call EndXXX to get the result. IAsyncResult
connects a particular call of BeginXXX to its corresponding EndXXX. But
there is still another probles (as you have pointed out). How does one know
its time to call EndXXX. That is solved by a property exposed by
IAsyncResult called IsCompleted. Using this you can poll your current active
call.

For more info:
http://msdn.microsoft.com/library/d...ml/cpconinvokingwebservicesasynchronously.asp

Thanks,
Mujtaba.
 
M

Mujtaba Syed

Having re-read your question, I realized that you need to know "how much"
(whatever that would mean) of the web method has executed and "how much" is
remaining.

There is no way to predict this but the web service client can simulate this
by storing a history of turnaround and predicting the time for n+1th
executing by averaging the first n executions. This is just an approximation
like all time based progress bars.

Also, progress bars based on data downloaded to the total data to be
downloaded make more sense.

Thanks,
Mujtaba.
 
J

Jonathan

I'm sorry if my question was unclear.
I'll try to elaborate.

What i'm trying to achieve is:
* A webservice with 1 long running task
* The webservice keeps track of the progress of this task
* An aspx page that polls the webservice for this progress

Normally i'd try and do this with the aid of session-state, but i've read
that session-state in combination with async calls doesn't work as expected.
The Microsoft sample i mentioned does run the way it should, but only polls
the webservice whether it is completed.
I'd need to modify this, so that it can poll for it's current progress.

I don't know whether it's at all possible to do this, but it seems to me it
shouldn't (have) to be that difficult?

I hope this clears things up.

TIA.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top