Check out the FileSystemWatcher class. It is designed specifically for
that purpose.
Though, if you are trying to do it within the contexts of a single web
service call, you will have to put the method to Sleep indefinitely
(waiting for the FileSystemWatcher event to wake it up).
If the process takes a long time, it probably isn't an appropriate use
of web services. Asynchronous or long running tasks are a major
weakness in the web service programming model.
Do your systems need to communicate with each other over the public
internet? If not, you probably do not need web services, as they will
bring a lot of unnecessary restrictions to your scenario. You might
want to look into a queue based system instead.
Joshua Flanagan
http://flimflan.com/blog
Keith wrote:
I am writing a web service that sends work to a system that gets it's
work via XML files. This system looks for files in a particular
directory, processes the file, then leaves a response file in the same
directory. What is the best way to wait for the reponse file? Is there
a better way than going into the following loop?
while(!System.IO.File.Exists(reponseFile) {
System.Threading.Thread.Sleep(1000);
}
thanks,
-Keith