This topic explains how to create and build a Java REST server object extension (SOE) using the Maven command line. You can generate a project in either interactive or non-interactive mode, configure the service type, and package the SOE for deployment to ArcGIS Server.

  1. Create the REST SOE project
  2. Configure the SOE service type
  3. Build the REST SOE project
  4. Deploy and test the REST SOE

Before proceeding, install the ArcGIS Enterprise SDK, a supported JDK, and Apache Maven. You must also install the SDK Maven artifacts into your local Maven repository. See Installation for setup instructions.

The examples below target ArcGIS Enterprise SDK 12.2 and use Maven archetype version 12.2.0. Verify that this version is included in the Maven artifacts installed with your SDK before running the commands.

Create the REST SOE project

The rest-soe-archetype Maven archetype generates a Java REST SOE project. You can use interactive mode to enter project properties when prompted or non-interactive mode to supply them in one command.

Use the Maven command in interactive mode

You can open the command prompt for Windows or Linux terminal and use the following Maven command to create a REST SOE project in interactive mode:

Use dark colors for code blocksCopy
1
mvn archetype:generate -DarchetypeGroupId=com.esri.arcgis.enterprise.sdk -DarchetypeArtifactId=rest-soe-archetype -DarchetypeVersion=12.2.0

For other versions of Enterprise SDK, remember to change -DarchetypeVersion to the corresponding version of the SDK, such as -DarchetypeVersion=12.2.0 for 12.2 Enterprise SDK. You need to specify the same version of the SDK you are using as the -DarchetypeVersion parameter.

After executing the above command, you are prompted to enter values for the following properties:

  • groupId: Type entsdksamples.soe.
  • artifactId: Type simplerestsoe as the project's name.
  • version: Press Enter to skip this property. This uses the default value 1.0-SNAPSHOT, indicating this project is still in development.
  • package: Press Enter to skip this property. This uses the groupId's value as the package name.
  • soeName: Type JavaSimpleRESTSOE
  • Y: Type Y to confirm your inputs.
building rest soe maven1

For additional information about Maven project properties, see Project creation.

Use the Maven command in non-interactive mode

If you would like to create the SOE or SOI project without interactivity, you can set the interactive property to false (-DinteractiveMode=false), or use the -B flag (see generate project in batch mode).

The following command will achieve the same result as the project above created in interactive mode:

Use dark colors for code blocksCopy
1
mvn archetype:generate -B -DarchetypeGroupId=com.esri.arcgis.enterprise.sdk -DarchetypeArtifactId=rest-soe-archetype -DarchetypeVersion=12.2.0 -DsoeName=JavaSimpleRESTSOE -DgroupId=entsdksamples.soe -DartifactId=simplerestsoe -Dversion=1.0-SNAPSHOT

Maven creates the simplerestsoe project directory using the supplied properties. The generated Java sources are under src/main/java.

Configure the SOE service type

After creating the project, configure the type of ArcGIS Server service the SOE will extend.

  1. Open the generated JavaSimpleRESTSOE.java file under src/main/java.

  2. Locate the @ServerObjectExtProperties annotation on the SOE class.

  3. Set the annotation's servicetype attribute to the appropriate value:

    ValueTarget service
    "MapService"ArcGIS Server map service
    "ImageService"ArcGIS Server image service

    For a map service, retain the default setting:

    Use dark colors for code blocksCopy
    1
    servicetype = "MapService"

    For an image service, change it to:

    Use dark colors for code blocksCopy
    1
    servicetype = "ImageService"
  4. Save the Java file. If you select ImageService, review the generated source code and replace map-service-specific interfaces, operations, and business logic with implementations supported by image services.

The servicetype attribute identifies the service type on which the SOE can be enabled. Changing this attribute does not automatically make the generated map-service sample compatible with image services.

Build the REST SOE project

Navigate to the generated project's root directory (the directory containing pom.xml), and run:

Use dark colors for code blocksCopy
1
2
cd simplerestsoe
mvn clean install

The clean phase removes previous build output. The install phase builds and packages the project and installs its Maven artifact in your local repository. The ArcGIS Enterprise SDK Maven packaging plugin generates the deployable .soe file during the build.

Maven build output for the Java REST SOE

After a successful build, look for the generated SOE package in the target directory, typically:

Use dark colors for code blocksCopy
1
target/simplerestsoe.soe

If the build fails, confirm that the SDK Maven artifacts are installed, that the POM references the correct SDK version, and that Maven is using the supported JDK. For more information, see Project build.

Deploy and test the REST SOE

Building the project does not deploy the SOE to ArcGIS Server. To use it:

  1. Deploy and register the extension with a compatible ArcGIS Server site.
  2. Enable the extension on a service of the type specified by servicetype.
  3. Open the service in the ArcGIS Server Services Directory and verify that the SOE is listed among the supported extensions. Test the operations implemented by the SOE.

For an example of testing the Simple REST SOE in the Services Directory, see Consume the SOE using the Services Directory.

Note: The sample's resources and operations are map-service-specific. When targeting an image service, test the operations implemented by your image-service-compatible SOE instead.

Also See

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