473,804 Members | 3,067 Online
Bytes | Software Development & Data Engineering Community
+ 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.I O.File.Exists(r eponseFile) {
System.Threadin g.Thread.Sleep( 1000);
}

thanks,

-Keith
Jul 21 '05 #1
3 1699
Check out the FileSystemWatch er 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 FileSystemWatch er 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.I O.File.Exists(r eponseFile) {
System.Threadin g.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 FileSystemWatch er 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 FileSystemWatch er 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.I O.File.Exists(r eponseFile) {
System.Threadin g.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 FileSystemWatch er 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 FileSystemWatch er 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(!Syste m.IO.File.Exist s(reponseFile) {
System.Threadin g.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
3218
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 characters. When I import it into A2K, that field is truncated. If I try to inport the file into an EXISTING table that I define myself where that field is a MEMO field, the import crashes.
0
2036
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 button, file size doesn't matter. I'm not possible to track if the file was completely downloaded or if the user only clicked the link and cancelled the download. I've created a simple "solution" of this problem, which waits until the
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 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); }
4
3272
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 onto some stack, where it would continue to be processed asynchronously (most importantly preserving things like view state, form post data, etc). In the interim, while the main request is processed, a friendly page will be displayed to the user....
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10578
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9152
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4300
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 we have to send another system
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.