Stream zip file in SOE

3245
1
04-30-2015 03:36 AM
AmmarAssem1
New Contributor

Hi Everyone,

I am try to stream zip file in SOE,

I tried this code

  responseProperties = "{\"Content-Type\" : \"application/octet-stream\",\"Content-Disposition\": \"attachment; filename=response.zip\"}";

  var data = File.ReadAllBytes(@"c:\arcgisserver\Config.zip");

  return data;

it works well when there's no parameters in SOE function but if the SOE function has parameter it returns corrupted zip file, I changed the extension of the downloaded zip file to .html and when I click on this file it opens the html page like the html of the soe function.

So can anyone advise me?

Thanks,

Ammar Assem.

0 Kudos
1 Reply
ChenLi2
New Contributor III

Hi Ammar,

It has been a while, so i am not sure if you already figured it out or not. But for your information, i used to see the same issue. Just make sure inside the CreatRestSchema() function, you will need to specify the parameter on your rest page within the RestOperation as "zip". otherwise, the default format will be html and json, which will corrupt your zip folder.

for example:

RestOperation operations = new RestOperation("downloadZip",

                                                                new string[] { "Foldername" },

                                                                new string[] { "zip" },

                                                                downloadZip,

                                                                downloadZipwithName);

Thanks

Chen

0 Kudos