.NET download file REST SOE
This sample illustrates how to develop a REST server object extension (SOE) with the capability of downloading server resources. The SOE generates a text file on the Server and allows clients to download the file from the Server. It also provides REST endpoints to manage those files such as obtaining file names and deleting the files.
Deploying the SOE from the .soe file (
..\bin\Release\DownloadFileRESTSOE_ent.soe) does not require you to open Visual Studio. However, you can load the project (
..\DownloadFileRESTSOE\DownloadFileRESTSOE.csproj) in Visual Studio to debug, modify, and recompile the SOE code.
- Returning formats other than JSON
- ArcGIS Server output directory
Any dynamic map service published from ArcGIS Pro. This instruction uses the USA map service as the sample service to test with the SOE.
Deploy the SOE
- Log in to ArcGIS Server Manager and click the Site tab.
- Click Extensions.
- Click Add Extension.
- Click Choose File and choose the DownloadFileRESTSOE_ent.soe file (
- Click Add.
Enable the SOE on a map service
- Make sure you have published the USA map service using ArcGIS Pro. If not, refer to USA map service.
- Log in to ArcGIS Server Manager and click the Services tab. Select USA map service and select Capabilities.
- In the list of available capabilities, find .NET Download File REST SOE and check the box to enable it.
- Click the Save and Restart button to restart the service.
Test the SOE in the ArcGIS Server Services Directory
Open a browser and navigate to the REST services endpoint of the USA map service (URL:
Scroll to the bottom of the above page. Find DownloadFileRESTSOE in Supported Extensions.
Click the SOE name, which leads to the following URL:
This SOE root resource page displays the SOE's description, the Files child resource, and two operations, DownloadFile and DeleteFile.
Click the DownloadFile operation.
Type in some contents in the inputText box. Choose file as the Format(f) parameter. Click the DownloadFile(GET) button. A text file named "testFile_xxxxxx.txt" is generated and downloaded to your local drive now.
Navigate back to the DownloadFile operation page.
Type in some contents in the inputText box. Choose html as the Format(f) parameter. Click the DownloadFile(GET) button. A text file named "testFile_xxxxxx.txt" is generated and can be accessed via the url provided in the response.
Navigate back to the root resource page again. Click the Files resource. You will see the two files generated in step 5 and step 7 are listed. Take a note of a filename.
Navigate back to the root resource page again. Click the DeleteFile operation.
10.Type in the filename from step 8 and click the DeleteFile(GET) button. The response success: true indicates that the file is successfully deleted from server. You can also repeate step 8 to confirm it.