You can use Asyncronous execution of Web Services. Take a look of the
following:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/html/
service10012002.asp
http://www.codeproject.com/cs/webservices/async_xmlws.asp
Take into account that your presentation tier must be able to wait for the
async end-process event. For instance, a WinApp-WinForms can wait for that
and-event. A Windows Service can also wait for that end-event, but a ASP.NET
web page as UI, should cannot wait for the event within the sever execution,
as the execution of a ASP.NET page must be done once and fast. It cannot be
waiting unless you use any Client Script (like AJAX/ATLAS, based on client
JScript) calling to the Web Service.
Regards,

Signature
CESAR DE LA TORRE
Software Architect
[Microsoft MVP - XML Web Services]
[MCSE] [MCT]
Renacimiento
[Microsoft GOLD Certified Partner]
Jon
I believe I understood your question a little differently than Cesar
did. As I understand it, you want the client to call the server
synchronously and have the web service respond immediately. Then you
want the web service to kick a new set of code after the response to
the client has been made. You don't want your client to have to worry
about any asynchronous actions.
In that case, you don't want to use an asynchronous web service call.
Just call your web service as you normally do, but have you web service
spawn a new thread that will launch the asynchronous code. I've
included an example below.
<WebMethod()> _
Public Function HelloWorld() As String
'create your new thread
Dim thread As New System.Threading.Thread(AddressOf
RunAsync_Proc)
'start the async thread
thread.Start()
'respond to your client while the other thread is still running
Return "Hello World"
End Function
Public Sub RunAsync_Proc()
'Put code here to do your asynchronous processing
End Sub
If you're interested, there is another option. You could potentially
use the SOAPDocumentMethodAttribute.OneWay property that is already
built into the .NET framework . It allows you to create web services
that automatically respond to the client before they begin their own
processing.
You can read more about this property at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemwebservicesprotocolssoapdocumentmethodattributeclassonewaytopic.asp
Hope that helps.
Peter Kelcey
CESAR DE LA TORRE [MVP] - 10 Oct 2005 11:27 GMT
Yes, indeed. If the caller does not need any 'end-work-response' about the
WebService execution, (end-value post-execution, etc.), if it is not waiting
for that, then, for sure, I agree.
The answer the client App. is gonna get will be just an 'ACK', I mean,
something saying it just started to work (but take into account that the
caller will not know if that background thread/job finished properly. Also,
you will not know when it finished). If that is OK for you, I completly
agree with Peter.
It would be like using messages with MSMQ (Microsoft Message Queue Service)
without 'end-of-work-responses' messages. You just send a message and you
trust that the other point will execute something.

Signature
CESAR DE LA TORRE
Software Architect
[Microsoft MVP - XML Web Services]
[MCSE] [MCT]
Renacimiento
[Microsoft GOLD Certified Partner]
--
CESAR DE LA TORRE
Software Architect
[Microsoft MVP - XML Web Services]
[MCSE] [MCT]
Renacimiento
[Microsoft GOLD Certified Partner]
> Jon
>
[quoted text clipped - 42 lines]
>
> Peter Kelcey
Secret Squirrel - 12 Oct 2005 16:05 GMT
Thanks for the suggestion Cesar and Peter.
Unfortunately, I have tried what you suggested previously and it's not
working. I do create a thread for the "time consuming process", start
it, and return the response. The problem is that in the "time consuming
process" thread, an error occurs:
System.Threading.ThreadAbortException: Thread was being aborted.
It seems like when the web service returns its response, this other
thread is getting aborted? I will test some simpler examples. It sounds
like this should NOT be happend?
Thanks,
Jon Paugh
Secret Squirrel - 12 Oct 2005 19:49 GMT
i figured it out - executing from my WS my code works just fine. But
executing from NUNit, my test fails. Apparently NUnit kills all child
threads when test is completed.
Thanks Again,
Jon Paugh