Simple REST SOE With capabilities sample


Purpose
The purpose of this sample is to show use of capabilities in a Server Object Extension.
This sample SOE has 2 sub-resources, busstations and trainstations, and 2 operations, findBusStationId and findTrainStationId. It also has 2 capabilities: "Bus Services" and "Train Services". The "Bus Services" capability controls access to the busstations subresource and the
findBusStationById operation, while the "TrainServices" capability controls access to the trainstations subresource and findTrainStationById operation.

How to use

See How to use ArcGIS samples for help on running the sample.

How to use this sample?
  1. Deploy the lib/JavaSimpleRESTSOEWithCapabilities.soe file to Server. For instructions on how to deploy an SOE to ArcGIS 10.1 Server, please see the "Developing Extensions" -> "Server Object Extensions" -> "Deploying and Un-deploying SOEs" topic in the ArcGIS Java Developer Help.
  2. Enable the SOE on map service of your choice. For instructions on how to enable SOE on a map service, please see the "Developing Extensions" -> "Server Object Extensions" -> "Enabling and Disabling SOEs" topic in the ArcGIS Java Developer Help. Please ensure that the map service has at least 1 feature layer and 1 raster layer.
  3. After the map service has started with SOE enabled on it, open up Services Directory and access the http://<server name>:6080/arcgis/rest/services page
  4. Click the map service you enabled your SOE on.
  5. Scroll down and click the JavaSimpleRESTSOEWithCapabilities listed in "Supported Extensions" section. If you don't find your REST SOE listed here, please log in as admin into Services Directory and clear the cache. Repeat steps 3,4, and 5.
  6. The JavaSimpleRESTSOEWithCapabilities web page displays the root resource details such as name and description, along with the "Child Resources" and "Supported Operations" sections.
  7. Click “layers” subresource. It displays information about all features layers in JSON format.
  8. Log in to ArcGIS Manager and edit the map service you enabled the SOE on. On the map service's editing page, click Capabilities and then click "Java Simple REST SOE With Capabilities". A section called "Operations Allowed" will appear below the SOE. Check the BusServices check box. Click "Save and Restart" button.
  9. Open the SOE page in Services Directory again and click on "NumberOfBusStations" subresource. This subresource will display some number of bus stations, thereby proving that this subresource is accessible.
  10. Navigate back to the SOE page and click "findBusStationById". Provide text input to the "busStationId" text box and click the "findBusStationById" button. The text you entered in the text box will be displayed, thereby proving that this operation is accessible.
  11. Access the "NumberOfTrainStations" subresource and "findTrainStationById" operation. In each case, the SOE will return an error message indicating that these are inaccessible. This is because the "TrainServices" capability is not enabled on this SOE.
  12. Log into to ArcGIS Manager, edit the map service, select the JavaSimpleRESTSOEWithCapabilities capability and enable its "TrainServices" capability. Test access to the "NumberOfTrainStations" subresource and "findTrainStationById" operation. You'll find that these are now accessible.

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

soe/JavaSimpleRESTSOEWithCapabilities.java The REST SOE Java Server Object Extension class.
lib/JavaSimpleRESTSOEWithCapabilities.soe The .soe file that contains this Server Object Extension




Development licensing Deployment licensing
Server Server