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.
- Create the REST SOE project
- Verify the service type
- Build the REST SOE project
- Deploy the SOE to ArcGIS Server
- 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/.
Create the REST SOE project
To create a REST SOE using Eclipse, complete the following steps:
-
Ensure that ArcGIS Enterprise SDK, Java, and Maven are all installed on your development environment. See more details in the Installation section.
-
Open Eclipse and select File > New > Maven Project. The New Maven Project wizard appears.
-
Uncheck Create a simple project (skip archetype selection) and click Next.
-
If the
rest-soe-archetypehas 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(use12.2.0for 12.2 SDK)
- GroupId:
-
The
rest-soe-archetypeis now added. Select this archetype and click Next.
-
Enter the information in the parameters below and click Finish:
- GroupId — entsdksamples.soe
- ArtifactId — simplerestsoe
- Package — entsdksamples.soe
- soeName — JavaSimpleRESTSOE
-
A new SOE project is created now. You should see the
entsdksamples.soepackage and theJavaclass under theSimple RESTSOE src\main\javafolder.
Configure the SOE service type
Before building, confirm the ArcGIS Server service type targeted by the SOE. In the generated SOE class, locate the @ annotation and review its servicetype attribute.
- For a map service, use
servicetype = "(the default for this tutorial).Map Service" - For an image service, use
servicetype = ".Image Service"
For example, a map service SOE uses:
@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 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 descriptiontoJava Simple RES(see B).T SOE -
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 installin Goals, click Apply, and click Run.
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 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 F). If you don't see the file, right-click and refresh thetargetfolder 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.
- Register the generated
.soefile with ArcGIS Server. See Deploy extensions. - Enable the extension on a map service published from ArcGIS Pro. See Enable extensions.
- 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.
- Open the Services Directory at
https. Use your site's configured URL if it differs.:// <server-name >:6443/arcgis/rest/services/ - Browse to the map service's root resource (a URL ending in
/).Map Server - Under Supported Extensions, select
Javato open the SOE's root resource.Simple RESTSOE - Review the Child Resources, including
layersandserviceproperties, and the Supported Operations, includingget. These names belong to the Simple REST SOE example; other SOEs may expose different resources and operations.Layer Count By Type - Select
layersto inspect the information exposed by the sample. Return to the SOE root resource and selectservicepropertiesto inspect the service properties exposed by the sample. - Select
get, enterLayer Count By Type featurefor thelayerparameter, and execute the operation. The JSON response includes the count of feature layers. You can also test supported values such asType raster,dataset, andall. - When testing is complete, disable or unregister the extension if it is no longer required. See Enable extensions and Deploy extensions.