473,480 Members | 2,967 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Waiting for a response file

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
Jul 21 '05 #1
3 1654
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

Jul 21 '05 #2
Joshau,

Thanks for the response. The directory won't be local to the hosts
needing this service. The communication will be over a LAN, not the
public internet. Can you give me more information regarding the 'queue
based system'? Maybe a link to some MSDN references?

thanks,

-Keith

Joshua Flanagan wrote:
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


Jul 21 '05 #3
I was referring to products like Microsoft's MSMQ.
http://www.microsoft.com/windows2000...mq/default.asp

You can get an idea of how it is used with .NET here:
http://msdn.microsoft.com/library/de...tnetasync2.asp
(it also references an earlier article with .NET MSMQ basics)

You may also want to explore .NET Remoting. I think you may be able to
raise an event from a remotable object, so that your calling client is
notified when the process is complete (the response file appears).

Joshua Flanagan
http://flimflan.com/blog

Keith wrote:
Joshau,

Thanks for the response. The directory won't be local to the hosts
needing this service. The communication will be over a LAN, not the
public internet. Can you give me more information regarding the 'queue
based system'? Maybe a link to some MSDN references?

thanks,

-Keith

Joshua Flanagan wrote:

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


Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3164
by: Richard Holliingsworth | last post by:
Hello: Thanks for your quick response. I'm trying to import a new Excel file into an A2K table and it's truncating the data. One of the Excel columns is a text field that can be up to 2000...
0
1954
by: ProJee | last post by:
Hi, Response.WriteFile (or Response.OutputStream.Write) finishes immediately, not after the file is completely downloaded. It finishes before (!) the user clicks the "Save" or "Open" browser...
3
252
by: Keith | last post by:
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...
4
3247
by: Jono | last post by:
Hi Everyone, As it says in the title, I'm looking for a way to display a page while long running operations are performed on the server. Ideally, I'd like some way to push the current request...
0
7037
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7080
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5326
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1296
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
176
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.