This topic describes how to create, build, and deploy a Java REST server object extension (SOE) using Apache Maven and Eclipse. It also explains how to access the SOE through the ArcGIS Server Services Directory.

  1. Create the REST SOE project
  2. Verify the service type
  3. Build the REST SOE project
  4. Deploy the SOE to ArcGIS Server
  5. Consume the REST SOE using the Services Directory

The example is based on the Simple REST SOE sample, available in the ArcGIS Enterprise SDK installation under Samples/Java/serverobjectextensions/simplerestsoe.

Create the REST SOE project

To create a REST SOE using Eclipse, complete the following steps:

  1. Ensure that ArcGIS Enterprise SDK, Java, and Maven are all installed on your development environment. See more details in the Installation section.

  2. Open Eclipse and select File > New > Maven Project. The New Maven Project wizard appears.

  3. Uncheck Create a simple project (skip archetype selection) and click Next.

  4. If the rest-soe-archetype has already been added, skip this step.

    Otherwise, click the Add Archetype button on the right, type the following values in the Add Archetype wizard, and click OK:

    • GroupId: com.esri.arcgis.enterprise.sdk
    • ArtifactId: rest-soe-archetype
    • Version: 12.2.0 (use 12.2.0 for 12.2 SDK)
    eclipse restsoe 12 2
  5. The rest-soe-archetype is now added. Select this archetype and click Next.

eclipse restsoe 12 2 archetype
  1. Enter the information in the parameters below and click Finish:

    eclipse restsoe1
    • GroupId — entsdksamples.soe
    • ArtifactId — simplerestsoe
    • Package — entsdksamples.soe
    • soeName — JavaSimpleRESTSOE
  2. A new SOE project is created now. You should see the entsdksamples.soe package and the JavaSimpleRESTSOE class under the src\main\java folder.

Configure the SOE service type

Before building, confirm the ArcGIS Server service type targeted by the SOE. In the generated SOE class, locate the @ServerObjectExtProperties annotation and review its servicetype attribute.

  • For a map service, use servicetype = "MapService" (the default for this tutorial).
  • For an image service, use servicetype = "ImageService".

For example, a map service SOE uses:

Use dark colors for code blocksCopy
1
2
3
4
5
6
@ServerObjectExtProperties(
    displayName = "Java Simple REST SOE",
    description = "Java Simple REST SOE",
    servicetype = "MapService"
    // Retain any additional attributes generated by the archetype.
)

Build the REST SOE project

Building an SOE project will package the project's classes, dependencies, and resources into a .soe file, which can be deployed to ArcGIS Server. Since it's a Maven project, the Maven build lifecycle must be followed to build the REST SOE. Read more about project build.

You can build the SOE project by using either the Maven Build tool or the Terminal view in Eclipse.

As the project is created from rest-soe-archetype, it automatically loads the boilerplate code that implements a ready-to-use SOE. For now, we can just customize the displayName and description of the SOE and leave the rest of the code as is.

developing rest soes eclipse4
  1. Open the SOE class JavaSimpleRESTSOE, located in the src\main\java folder (see A in the example above).

  2. Set the displayName and description to Java Simple REST SOE (see B).

  3. Follow these steps to build the project.

    • To build the project using Maven Build, do the following:

      a. Right-click the project and choose Run As > Run Configuration.

      b. Double-click Maven Build from the list on the left side of the Run Configuration wizard.

      c. The New_configuration wizard appears. Click Workspace to set the current project as the workspace. Type clean install in Goals, click Apply, and click Run.

      developing rest soes eclipse5

      d. The project is built successfully, with detailed log messages in the Console view (see C).

    • Alternatively, to build the project in the Terminal view, do the following:

      a. Click the Terminal tab at the bottom of Eclipse (see D).

      If you can't find this tab, you need to add this view from Window > Show View > Other > Terminal (see E).

      b. On the Terminal view, click Open a Terminal, which is a blue button on the right. A terminal is activated.

      c. Ensure the current directory is pointing to the project's base directory.

      d. Type mvn clean install. This command does a clean build of the project and you should see Build Success.

  4. Once the build finishes, a new folder named target appears in the project's base directory, and you can find the SOE file simplerestsoe.soe in this folder (see F). If you don't see the file, right-click and refresh the target folder or the project.

If you would like to add third-party libraries as dependencies, you can add them to the project's pom.xml (see G). The POM contains project configuration information, such as the Java compiler (JDK) used, plug-ins used, project's dependencies, and project's version. Learn more about POM dependency management.

Deploy the SOE to ArcGIS Server

Before an SOE can be used, it must be registered with a compatible ArcGIS Server site and enabled on a supported service.

  1. Register the generated .soe file with ArcGIS Server. See Deploy extensions.
  2. Enable the extension on a map service published from ArcGIS Pro. See Enable extensions.
  3. Confirm that the service and its extension are available before testing.

Consume the REST SOE using the Services Directory

After enabling the Simple REST SOE on a map service, use the ArcGIS Server Services Directory to inspect and invoke its resources and operations.

  1. Open the Services Directory at https://<server-name>:6443/arcgis/rest/services/. Use your site's configured URL if it differs.
  2. Browse to the map service's root resource (a URL ending in /MapServer).
  3. Under Supported Extensions, select JavaSimpleRESTSOE to open the SOE's root resource.
  4. Review the Child Resources, including layers and serviceproperties, and the Supported Operations, including getLayerCountByType. These names belong to the Simple REST SOE example; other SOEs may expose different resources and operations.
  5. Select layers to inspect the information exposed by the sample. Return to the SOE root resource and select serviceproperties to inspect the service properties exposed by the sample.
  6. Select getLayerCountByType, enter feature for the layerType parameter, and execute the operation. The JSON response includes the count of feature layers. You can also test supported values such as raster, dataset, and all.
  7. When testing is complete, disable or unregister the extension if it is no longer required. See Enable extensions and Deploy extensions.

Also See

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.