This topic describes how to create, build, and deploy a REST server object extension (SOE) under the Maven framework using Eclipse. It also describes how to consume the SOE from the ArcGIS Server Services Directory.
- Create the REST SOE project
- Build the REST SOE project
- Deploy the SOE to ArcGIS Server
- Consume the REST SOE
The SOE that you will create in this topic is also provided as a sample, named Simple REST SOE in the ArcGIS Enterprise SDK(..\
).
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-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:
11.3.0
(use11.3.0
for 11.3 SDK and10.9.1
for 10.9.1 SDK)
- GroupId:
-
The
rest-soe-archetype
is 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.soe
package and theJava
class under theSimple RESTSOE src\main\java
folder.
Verifying the servicetype
Since the Rest SOE project has already been created, please confirm which type of SOE you would like to generate: Map Service or Image Service. If you are working with a Map Service, simply keep the default settings shown in the screenshot below, where servicetype = "MapService". However, if you need an Image Service, update servicetype to "ImageService".
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\java
folder (see A in the example above). -
Set the
display
andName description
toJava 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 install
in 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
target
appears in the project's base directory, and you can find the SOE filesimplerestsoe.soe
in this folder (see F). If you don't see the file, right-click and refresh thetarget
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
The SOE you created must be deployed to ArcGIS Server and enabled on a map service. To learn how to deploy an SOE, see the Deploy extensions topic in the ArcGIS Enterprise SDK help. Note that the term “deploy” is used here to mean uploading the .soe
file to ArcGIS Server and registering it as an extension to map services. To learn how to enable an SOE on a map service, see the Enable extensions topic in the ArcGIS Enterprise SDK help.
Consume the SOE using the Services Directory
To consume the SOE using the Services Directory, complete the following steps:
- Open the Services Directory at
https
.:// <server name >:6443/arcgis/rest/services/ - Navigate to your map service’s root page (its URL ends with “/MapServer”) and scroll down to the Supported Extensions section.
- Click the
Java
hyperlink. This brings up the SOE’s root resource web page, which lists name and description of the root resource, along with theSimple RESTSOE layers
andserviceproperties
sub-resource in the Child Resources section and theget
operation in the Supported Operations section.Layer Count By Type - Click on the
layers
sub-resource. It displays information about all layers in JSON format. - Navigate back to the root resource page and click on the
serviceproperties
sub-resource. It displays several service configuration properties. - Navigate back to the root resource page and click on the
get
operation. EnterLayer Count By Type feature
in the layerType field and click the GET button. The JSON response will include the number of feature layers. Test this operation with other types, such asraster
,dataset
, orall
. - Undeploy the SOE when you're finished. To learn how to undeploy the SOE, see the deploy extensions topic in the ArcGIS Enterprise SDK help