Exporting .soe files using command line interface

This topic discusses creation of .soe files outside of the Eclipse IDE, using command line tools. This attempts to address needs of users that need to create .soe files via command line tools that could be by automated scripts.

At ArcGIS 10.1 and above, the deployment workflow for Java and .NET SOEs has changed significantly. This includes use of a container file, called a .soe file, to hold SOEs. A Java SOE exported by the Eclipse "Export SOE" wizard therefore resides in a .soe file, along with all its dependencies and accessories. The same is true also for .NET SOEs exported by Visual Studio.
In order to generate .soe files containing Java SOEs in an environment where Eclipse IDE is not available, the Java ArcObjects SDK includes a tool called SOEPackager. This tool can be invoked from the command line. It requires a jar file containing the SOE as input and generates a .soe file as output.



SOEPackager resides in the $AGSDEVKITJAVA/java/tools/soepackager folder. On Windows, it can be invoked via the soepackager.bat file. On Linux, the soepackage.sh script could be used. The following is its usage:
soepackager.bat -p [path to SOE jar file] -o [path to output folder] -j [path to the JDK] [optional parameters]
soepackager.sh -p [path to SOE jar file] -o [path to output folder] -j [path to the JDK] [optional parameters]
Following are required parameters to soepackager:
-p: absolute path to jar file containing SOE classes and dependencies
-o: absolute path to folder that must hold the newly generated .soe file
-j: path to the JDK. If the "bin" directory in JDK home is not added to your environment PATH variable, then the JDK path can be supplied directly using this parameter.
Following are optional parameters to soepackager:
-h: Shows help message
-n: Name of SOE (e.g. TestSOE). If using spaces, please enclose in double quotes.
-d: Description of SOE (e.g. "This is a test SOE")
-v: SOE Version (e.g. 1.0)
-a: SOE Author (e.g. "John Doe")
-c: Company/Organization name (e.g. "Esri")
-t: Target deployment version (e.g. 10.2)
-f: Semi-colon separated list of dependent jar files (overrides value of -l if both -f and -l are provided)
-l: Folder containing dependent jar files (ignored if -f is also used)

How to include dependent jar files?

For SOEs that depend on external jars, ensure that the SOE jar file's manifest does specify these jars in the Class-Path entry, as shown below. Use of folder names and relative paths is not supported, since all dependent jars will be housed in the same folder as SOE jar at runtime.
To bundle the dependent jars into the .soe file, the -f or -l options could be used. The -f option allows specifying one or more jar files (i.e. the absolute path to the jar files), separated by space.
soepackager.bat -p <absolute path to SOE jar file> -o <absolute path to output folder> -f "<absolute path to jar file 1> <absolute path to jar file 2>"
The -l option allows specifying a directory containing jar files.
soepackager.bat -p <absolute path to SOE jar file> -o <absolute path to output folder> -l "<absolute path to directory containing jar files>"
If -f and -l options are used simultaneously, the -f option overrides the -l option.
Including ArcGIS Manager custom property page
A custom property page for ArcGIS Manager is made up of a bunch of JavaScript and HTML files, representing the Dojo widget and UI components of the property page respectively. Inside the SOE's jar file, these .js and .html files must reside in a folder called "Resources" , which must exist at the root of the jar file (see screenshot below). If a namespace is being used in the Dojo widget (e.g. arcgissamples.soe.SimpleRESTSOEWithProperties), then the folder hierarchy in "Resources" folder must reflect the namespace hierarchy. In absence of namespace, the .js/.html files can reside directly in "Resource" folder.
If the above structure is unavailable as described, SOEPackager will be unable to generate appropriate artifacts and related metadata in the .soe file. The .soe file will then still deploy to ArcGIS Server successfully, but the behavior of concerned SOEs, while enabling on map service or during runtime, would not be along expected lines.

Development licensingDeployment licensing