web service serve up files

  • Thread starter Thread starter feng
  • Start date Start date
F

feng

Hi,

I need to implement a function, GetAllFiles, of a web
service that once called, returns all the files in a
folder to the caller. My question is: what is the best way
to implement this function? If it is just one file, I can
use FileSteam's OpenRead and return
a Byte array to the caller. But in my case I need to
transfer multiple files and I don't think calling the
function mutiple times in a loop is very efficient. What
do I do?

Thanks
 
sounds like a homework problem.

So, in protocols like FTP, is there a "get all files?" No. because it
doesn't make much sense.

On the other hand, if a webservice returns information about each of the
files in a directory (like a listing: filename, size, date, etc) and the
client can call another webservice method to get any PARTICULAR file, then
the client can easily ask for the listing, get it, the turn around and ask
for each file.

For a real world system, this makes much more sense than the notion of "get
all files" returning multiple binary streams.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
Thanks Nick!

Thank you for your input. I think I should have asked my
question a little clearer. Actually, I am developing a
deployment mechenisam for a Windows form application. The
web server acts as an deploy server and its only job, once
called, is to return all the exes and dlls to the client.
The client, as a matter of fact, already know all the info
about the files contained on the server's deploy
directory. It doesn't need the server to tell it anything
about the file properties. The only thing it needs from
the server is to GetAllFiles from the deploy directory.

Now, if this sounds making a little more sense, I would
like to come back to my orrigional question: How do I
implement the operation of returning muliple files from
the server? I don't want to make one server call for each
file. That would be too inefficient.

Any idea?

Thanks again!
 
zip all files into one file?



"feng" <[email protected]> escribió en el mensaje
Thanks Nick!

Thank you for your input. I think I should have asked my
question a little clearer. Actually, I am developing a
deployment mechenisam for a Windows form application. The
web server acts as an deploy server and its only job, once
called, is to return all the exes and dlls to the client.
The client, as a matter of fact, already know all the info
about the files contained on the server's deploy
directory. It doesn't need the server to tell it anything
about the file properties. The only thing it needs from
the server is to GetAllFiles from the deploy directory.

Now, if this sounds making a little more sense, I would
like to come back to my orrigional question: How do I
implement the operation of returning muliple files from
the server? I don't want to make one server call for each
file. That would be too inefficient.

Any idea?

Thanks again!
 
To answer your question: One format that can represent multiple files is
MIME. You can essentially make each file an attachment in a MIME message,
embed the MIME message into a SOAP response, and return that response after
your call.

I disagree that multiple calls is inefficient in some way. However, I hope
the info helps.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top