This topic describes how to create, build, and deploy a Java REST server object extension (SOE) using IntelliJ IDEA and Maven. It also explains how to test the SOE using 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. Test the REST SOE using the Services Directory

This tutorial uses the Simple REST SOE sample included with the ArcGIS Enterprise SDK. In a typical Windows installation, the sample is located under EnterpriseSDK\Samples\Java\serverobjectextensions\simplerestsoe.

Create the REST SOE project

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

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

  2. Launch IntelliJ and click File.

  3. Click New and Select Project.

  4. Choose Maven Archetype on the left menu.

  5. Give name for the project and choose the location you would like to use.

  6. Ensure the project SDK is set to the supported JDK before you proceed.

  7. Keep the Catalog as Internal.

  8. For Archetype: Click the Add button on the right, type the following values in the Add Archetype wizard, and then click Add:

    • GroupId: com.esri.arcgis.enterprise.sdk
    • ArtifactId: rest-soe-archetype
    • Version: 12.2.0 (use 12.2.0 for 12.2 SDK)
    Intellij developing rest soes 12 2

    The rest-soe-archetype is now added.

  9. To set up the Advance Settings before creating the SOI, click Advanced Settings.

    Intellij developing rest soes 12 2 soeName
  10. Confirm the information in the parameters are right and appropriate and click Create: If you see any warnings, you can ignore them for now as long as the project successfully generates the entsdksamples.soe package and JavaSimpleRESTSOE class under the src\main\java folder. You will address those warnings during project build. Continue to build the REST SOE project now.

Configure the SOE service type

The generated REST SOE must target a supported ArcGIS Server service type. Open the generated SOE class and review the servicetype attribute in its @ServerObjectExtProperties annotation:

  • Map service: Use servicetype = "MapService".
  • Image service: Use servicetype = "ImageService".
serviceType

The Simple REST SOE example in this tutorial targets a map service. If you change the service type to ImageService, also review and adapt any map-specific interfaces, operations, and business logic. Changing the annotation alone does not make a map-service implementation compatible with image services.

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 in either the Maven tool window or the Terminal tool window.

developing rest soes6

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

  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 be Java Simple REST SOE (see B).

  3. Now follow these steps to build the project.

    • To build the project in the Maven tool window, do the following:

      a. Click the Maven tab on the right side of IntelliJ (see C).

      b. Expand simplerestsoe. You should see Lifecycle, Plugins and Dependencies listed.

      c. If you don't see Dependencies, click the Reimport All Maven Projects button (see D) on the far left of the tool bar in the Maven tool window.

      d. Now you should see Dependencies, and com.esri.arcgis.enterprise.sdk:arcgis-enterprise-sdk:version is listed as one of the dependencies.

      e. Expand Lifecycle and click install. You can also click clean and click install for a clean build of the project.

      f. The project is built successfully with detailed log messages in the Run tool window (see E).

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

      a. Click the Terminal tab at the bottom of IntelliJ (see F).

      b. Ensure the directory is pointing to the project's root directory.

      c. 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 G).

If you would like to add third-party libraries as dependencies, you can add them to the project's pom.xml (see H). 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

Building the .soe file does not automatically register the extension with ArcGIS Server. The extension must be registered, then enabled on a compatible service.

  1. Register the generated .soe package with the target ArcGIS Server site. See Deploy extensions.
  2. Enable the SOE on a compatible map service for this tutorial. See Enable extensions.
  3. Verify that the service is running and that the SOE appears among its supported extensions.

For ArcGIS Server on Windows or Linux, the referenced deployment instructions use ArcGIS Server Manager. For supported ArcGIS Enterprise on Kubernetes environments, use the deployment and management workflow appropriate to that environment.

Test the REST SOE using the Services Directory

The following steps apply to the Simple REST SOE example, not to all REST SOEs. The resources and operations exposed by other SOEs depend on their implementations.

  1. Open the ArcGIS Server Services Directory at https://<server-name>:6443/arcgis/rest/services/. Replace <server-name> with your server's hostname and use the URL appropriate to your deployment.
  2. Open the map service on which the SOE is enabled. Its REST URL ends in /MapServer.
  3. In Supported Extensions, select the JavaSimpleRESTSOE link. The SOE's root resource lists the sample's layers and serviceproperties child resources and the getLayerCountByType operation.
  4. Open the layers resource to inspect the sample's layer information.
  5. Return to the SOE root and open serviceproperties to inspect the properties returned by the sample.
  6. Return to the SOE root and select getLayerCountByType. Enter feature for layerType, then select GET. Inspect the JSON response for the reported feature-layer count. You can also try the values raster, dataset, and all supported by the sample.
  7. When you no longer need the extension, disable it on the service and, if appropriate, unregister it. 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.