WebService - return before processing

lamy

Regular
Joined
Dec 12, 2005
Messages
56
Location
under your bed
im using a webservice to process things and return the result, now im planning to do this

- send request via webservice (from client side)
- return an acknowledgement (that i received the request) (to client side)
and breaks the connection
- process it (on server side)
- return the process result (to client side)

atm, i have these

- send request via webservice (from client side)
- process it (on server side) and return the result (to client side)

my question is, is there a way to push the process result via webservice or process something after i return an acknowledgement to client side?
 
If you are using .Net to call the webservice then you are probably calling it through the generated proxy class generated either by Visual Studio or by the command line WSDL.exe tool.

If this is the case then every method should have a BeginXXXX EndXXXX set of methods - calling the Begin method will start the call on a background thread and allow the calling code to continue running. You can later call the End method to get the results.
The Begin method also allows you to specify a callback routine so you can be automatically notified when the call completes.
 
tnx PlausiblyDamp. ill take a look at that, i guess asynchronous is the way ^^ have any snippets? cant find much on the net

im doing everything in .net, my winform application is calling the web method (webservice)
 
Last edited:
got a question PlausiblyDamp, what if i wanted to be notified that i got the request first, and get notified (return the result) when the process is done, like

BeginSomething
- notify that i received the request (return a value)
- (should trigger the process or do the process at the End)

EndSomething
- process the request
- notify that the process is done (return a value)

can this be done by this?

after reading some articles, it seems that asynchronous would only be like threadingm, or am i wrong.

what im trying to accomplish is to return maybe 2 separate results, with the first one as immediate and the other as soon as it finish processing, by just requesting one webservice method?

atm, in my application im populating a datatable with all the references from the request, and use it to check the result in a loop, but this is by using 2 webservice method (one to acknowledge the request, and the other to check for result)
 
Last edited:
Web services aren't really designed to work that way - they are ultimately a simple client server / request + response system and do not provide a way for the server to push further information down to the client.

If you need to do something more complex (request + response + response) then you could possibly implement some form of state management on the server side and have the client periodically poll the server, however this will impact scalability and performance and possibly be far more complicated than is really practical.

In your model you are trying to return 2 seperate pieces of information, the fact that a request has been received and then the results - could you not assume the request was received by the fact it didn't fail and report an error?

If this is required functionality then webservices may not be the appropriate technology (possibly remoting may be more suitable).
 
Back
Top