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.
- Create the REST SOE project
- Verify the service type
- Build the REST SOE project
- Deploy the SOE to ArcGIS Server
- 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 Enterprise.
Create the REST SOE project
To create a REST SOE using IntelliJ, complete the following steps:
-
Ensure that ArcGIS Enterprise SDK, Java, and Maven are all installed on your development environment. See more details at the Installation section.
-
Launch IntelliJ and click File.
-
Click New and Select Project.
-
Choose Maven Archetype on the left menu.
-
Give name for the project and choose the location you would like to use.
-
Ensure the project SDK is set to the supported JDK before you proceed.
-
Keep the Catalog as Internal.
-
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(use12.2.0for 12.2 SDK)
The
rest-soe-archetypeis now added. - GroupId:
-
To set up the Advance Settings before creating the SOI, click Advanced Settings.
-
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.soepackage andJavaclass under theSimple RESTSOE src\main\javafolder. 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 @ annotation:
- Map service: Use
servicetype = ".Map Service" - Image service: Use
servicetype = ".Image Service"
The Simple REST SOE example in this tutorial targets a map service. If you change the service type to Image, 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.
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 display and description of the SOE and leave the rest of the code as is.
-
Open the SOE class
Java, located in theSimple RESTSOE src\main\javafolder (see A in the example above). -
Set the
displayandName descriptionto beJava Simple RES(see B).T SOE -
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 seeBuild Success.
-
-
Once the build finishes, a new folder named
targetappears in the project's base directory, and you can find the SOE filesimplerestsoe.soein 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.
- Register the generated
.soepackage with the target ArcGIS Server site. See Deploy extensions. - Enable the SOE on a compatible map service for this tutorial. See Enable extensions.
- 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.
- Open the ArcGIS Server Services Directory at
https. Replace:// <server-name >:6443/arcgis/rest/services/ <server-namewith your server's hostname and use the URL appropriate to your deployment.> - Open the map service on which the SOE is enabled. Its REST URL ends in
/.Map Server - In Supported Extensions, select the
Javalink. The SOE's root resource lists the sample'sSimple RESTSOE layersandservicepropertieschild resources and thegetoperation.Layer Count By Type - Open the
layersresource to inspect the sample's layer information. - Return to the SOE root and open
servicepropertiesto inspect the properties returned by the sample. - Return to the SOE root and select
get. EnterLayer Count By Type featureforlayer, then select GET. Inspect the JSON response for the reported feature-layer count. You can also try the valuesType raster,dataset, andallsupported by the sample. - When you no longer need the extension, disable it on the service and, if appropriate, unregister it. See Enable extensions and Deploy extensions.