472,992 Members | 3,808 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,992 software developers and data experts.

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 1620
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
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
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
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
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
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.