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 (
../downloadfilerestsoe/target/downloadfilerestsoe.soe) does not require you to open a Java IDE. However, you can open the project (
../downloadfilerestsoe) in a Java IDE, such as Eclipse or IntelliJ, to debug, modify, and recompile the SOE code.
- outputFormat (IRequestHandler.handleRESTRequest)
- 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.
- Log in to ArcGIS Server Manager and click the Site tab.
- Click Extensions.
- Click Add Extension.
- Click Choose File and choose the downloadfilerestsoe.soe file (
- Click Add.
- 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 Java Download File REST SOE and check the box to enable it.
- Click the Save and Restart button to restart the service.
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 JavaDownloadFileRESTSOE 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.