Point of Interest Finder REST Server Object Extension


Purpose
The sample Server Object Extension is a REST resource that allows users to find points of interest such as gas stations and restaurants in the city of Portland, OR.
 
This REST resource (also called "root resource") has sub resources called Gas Stations and Restaurants. Both sub-resources are collections.
 
The root resource also has 2 operations: findGasStationByName() and findRestaurantByName().
Both operations take in the name of their respective POI types (partial name is also accepted) and return details in json format.
 
Figure 1 below shows schema of this REST SOE using UML Class Diagram notations.

How to use

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

Data has been provided for your use with this sample. It can be found at <Your ArcGIS Developer Kit Install directory>/Samples/data/mxds/portland.mxd and <Your ArcGIS Developer Kit Install directory>/Samples/data/portland/portland.gdb.
If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

POI Finder REST SOE Schema
  1. Figure 1 below shows structure of POIFinder SOE, i.e. its operations and sub resources.
  2. If you follow instructions in this document to deploy POIFinder SOE to ArcGIS Server, the root URL of the SOE a REST resource would be http://<serverName>:8399/arcgis/rest/services/portland, with "portland" being the map service name.
  3. URLs in Figure 1 below are relative to the above root URL. For example, the final URL for the root resource would be http://<serverName>:8399/arcgis/rest/services/portland/MapServer/exts/POIFinderSOE.


  4. Figure 1: POIFinder SOE REST Schema

How to deploy POIFinder SOE to ArcGIS Server?
  1. Copy the POIFinder_RESTExt.jar file that holds this SOE, from the $AGSDEVKITJAVA/java/samples/arcobjects/serverobjectextensions/poifinder_rest/lib folder to $AGSSERVERJAVA/java/lib/ext folder.
  2. Alternatively, if you open this sample's Eclipse project in Eclipse IDE, you can export the POIFinderSOE.java file to a jar file and save the jar file to the $AGSSERVERJAVA/java/lib/ext folder.
  3. Log into ArcGIS Manager. Navigate to "Manager Extensions" page in "GIS Server" section.
  4. Refresh this page. If the jar file containing POIFinder SOE does exist in $AGSSERVERJAVA/java/lib/ext folder, then ArcGIS Manager will display a record for this SOE on this page.
  5. Click on "Register" link next to the POIFinder SOE.
  6. The POIFinder SOE is now registered as extension to all Map Services.

How to enable POIFinder SOE with particular instance of Map service?
  1. Publish a map document as map service using ArcGIS Manager or ArcCatalog's "Publish GIS Resource" or "Add New Service" wizards.
  2. Create the map service using the "portland" map document from $AGSDEVKITJAVA/java/samples/data/mxds folder. The POIFinder SOE sample is designed to extend a map service that’s based on this portland map document only. We'll call this map service "portland".
  3. On the "Capabilities" page of "Publish GIS Resource" or "Add New Service" wizards, select the capability that matches with POIFinder SOE. Ensure that the check box next to the capability is checked. If there is no capability that matches with "POIFinder", please check if previous SOE deployment and registration step was executed correctly.
  4. If the SOE has capabilities of its own, please select the appropriate ones.
  5. Complete the publishing process and restart map service if necessary.
  6. Ensure that map service shows POIFinder SOE as a capability after it is started, in ArcCatalog or ArcGIS Manager.

How to access POIFinder REST resource?
  1. Open Services Directory web application (at http://<your server name>:8399/arcgis/rest/services/portland/MapServer).
  2. Scroll down the web page to "Supported Extensions:" section and click "POIFinderSOE" extension. The POIFinderSOE web page displays the POIFinder SOE's name, description, gas station and restaurant collections, and links to the SOE's operations.
  3. Scroll down to the "Supported Interfaces:" section. Click "REST". This displays info about the resource in json format.
  4. Navigate back to "POIFinderSOE" web page.
  5. Click "Schema". The "Schema" page displays this resource's schema, i.e. its sub-resources, operations, parameters of each operation and supported output formats.

How to consume POIFinder REST resource's operations?
  1. Navigate back to "POIFinderSOE" web page.
  2. Scroll down to the "Supported Operations: " section on the "POIFinder" page,
  3. Click the "findGasStationByName" link.
  4. Enter value for gas station name. This operation also accepts partial name of gas station as input. Type in "Shel" to find Shell gas stations or "Elev" for 7-Eleven gas stations.
  5. Select output format.
  6. Click on "findGasStationByName(GET)" or "findGasStationByName(POST)" button. All gas stations that have names partially matching with your input will be displayed.
  7. Navigate back to "POIFinderSOE" web page.
  8. Click the "findRestaurantByName" link.
  9. Enter value for restaurant name. This operation also accepts partial name of a restaurant as input. Type in "Thai" to find restaurants that include this text it their name.
  10. Select output format.
  11. Click on "findRestaurantByName(GET)" or "findRestaurantByName(POST)" button. All restaurants that have names partially matching with your input will be displayed.

How to consume POIFinder resource's sub-resources?
  1. Navigate back to "POIFinderSOE" page.
  2. Scroll down to the "Gas Stations: " section.
  3. Click one of the gas stations listed here or type in http://<serverName>:8399/arcgis/rest/services/portland/MapServer/exts/POIFinderSOE/GasStations/3 to access gas station with id 3. Try accessing gas stations with different ids.
  4. Navigate back to "POIFinderSOE" page.
  5. Scroll down to the "Restaurants: " section.
  6. Click one of the restaurants listed here or type in http://<serverName>:8399/arcgis/rest/services/portland/MapServer/exts/POIFinderSOE/Restaurants/5 to access restaurant with id 5. Try accessing restaurants with different ids.

How to disable POIFinder SOE with "portland" Map service?
  1. Use ArcGIS Manager or ArcCatalog to access "portland" map service's properties.
  2. On "Capabilities" page, uncheck the check box next to POIFinderSOE Capability.
  3. Save the map service and restart it if necessary.
  4. The POIFinder SOE is now disabled on the "portland" map service.

How to un-deploy POIFinder SOE?
  1. Log into ArcGIS Manager. Navigate to "Manager Extensions" page in "GIS Server" section.
  2. Click "UnRegister" link next to POIFinderSOE.
  3. The POIFinder SOE is now unregistered from ArcGIS Server.
  4. Remove the SOE's jar file from $AGSSERVERJAVA/java/lib/ext folder.


Download the files for Java
soe/POIFinderSOE.java The POI Finder Java Server Object Extension class.




Development licensing Deployment licensing
Server Server