How to use Asychronous calls

S

SenthilVel

Hi all

i have a requirement in my application where in need to call a web service:

1. My client calls my webservice .
2. when i receive a call from my web servcie i need to notify my client that
"Process started".
3. i need to return the Message "Process Started " and in the background i
need to continue the work which the WebService method is intended to do .
4. once i complete the work in the webservice , i need to send a reault back
to my client.

Client -->WS -->Replies a messages to client (Process started)

WS->completes the work and sends a Result --->Client.

must i use asychronus calls ?
must i use multi threading ?
How can i do this ?

Thanks
Senthil
 
G

Guest

your first two questions are pretty well identical, and since you want to
start the processing and allow the client to continue work, then yes you have
to use an asynchronous call which means you have to thread it.

since it's an async call, you can take a hint from the async calls built
into the .NET framework in taht they all take a "callback delegate" of some
sort.

Basically you'll make a call to your service with a delegate to the method
in your client that you want to be called when the service is complete.

Service.start(parameter, delegate);

service.start(parameter, delegate) {
// spawn thread to do work
}

service.thread(parameter, delegate) {
// Do your work
// Invoke the delegate
}

should do the trick
 

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

Top