views:

39

answers:

1

Hi,

I have to send some files through a webservice in C#. The files to be sent can be from different locations i.e. there is one folder having 4 files and another folder having 5 files. Assuming i have a mechanism to select which files to send. What would be the best way to send those files? Should I be sending them one by one and let the client figure out how to put them together, or zip all the files into a single file and send that zip file to the client. If there is any other way to implement this, I would be more than happy to look into that approach too.

Thanks

+1  A: 

It really depends on the web service interface you are using. Do you have control of the API, ie. can you define the methods of the web service? If yes, then you can define a method that takes an array of byte arrays (byte[][]) as a parameter to receive multiple files in one call. On the other hand, if the files are large, sending all the files in one method call would prove problematic (maximum size of message). Also, should the files be logically grouped? I mean does the server need to know that these 5 files are from a certain directory from a certain client? If no, then it might be a better idea to send one file at a time.

Kyberias