SOI properties

This topic demonstrates how to implement properties and a custom property page in an SOI.

SOI default properties

SOIs can expose a set of read-write name-value pairs stored as a PropertySet. These properties appear as text boxes in ArcGIS Server Manager and can be changed by the server administrator, allowing the SOI to accept dynamic inputs managed by the server administrator. As SOI properties persist after the map service restarts and ArcGIS Server restarts, they can also be used as global control variables.

SOI properties are specified at SOI class attribute (ServerObjectInterceptorAttribute). You can define and manage the properties as follows:

  1. Create a new SOI project called SimpleSOIProperties.

  2. In SimpleSOIProperties.cs, add properties as the following code:

    Use dark colors for code blocksCopy
    1
    2
    3
    4
    [ServerObjectInterceptor("MapServer",
        Description = "",
        DisplayName = "SimpleSOIProperties",
        Properties = "isEditable=false;configFile=")]

    The first property's name is isEditable, with a default value of false. The second property, configFile, doesn't have any default value assigned.

  3. Implement IObjectConstruct to work with the SOI properties.

    To get and set the SOI properties, you need to implement the IObjectConstruct interface and use the IObjectConstruct.Construct() method. The Construct() method is triggered right after SOI initialization.

    Use dark colors for code blocksCopy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    public class SimpleSOIProperties : IServerObjectExtension, IRESTRequestHandler, IWebRequestHandler, IRequestHandler, IObjectConstruct
    {
    //...
        public void Construct(IPropertySet props)
        {
            string editableString = props.GetProperty("isEditable") as string;
            if (editableString.ToLower().Equals("true") || editableString.ToLower().Equals("false"))
            {
                bool isEditable = Convert.ToBoolean(props.GetProperty("isEditable"));
                _serverLog.LogMessage(ServerLogger.msgType.infoSimple, "Construct()", 200, "Editable: " + isEditable.ToString());
            }
            else
                _serverLog.LogMessage(ServerLogger.msgType.warning, "Construct()", 200, "Editable property is invalid.");
            string configFile = props.GetProperty("configFile") as string;
            _serverLog.LogMessage(ServerLogger.msgType.infoSimple, "Construct()", 200, "Config File: " + configFile);
        }
        //...
    }

    The properties are passed as the IPropertySet in the Construct() method. You can write their values in Server logs for testing.

  4. Now let's compile this project and deploy the SOI.

    In ArcGIS Server Manager, browse to the Capabilities page of a map service. When the SOI is selected, you will see the following Properties text boxes:

    soiprops1
  5. If you enable the SOI and click the Save and Restart button, you will be able to find the logs the SOI writes in server logs.

    soiprops2
  6. Edit one of the properties.

    soiprops3
  7. Click the Save and Restart button again.

    Now the Capabilities page shows the updated SOI properties. Check the server logs and you will find the changes are also logged by the SOI during service restart.

SOI custom property page

If you want to use HTML elements and widgets to help the server administrator manage the SOI properties better, such as a drop-down list of available selections, a password field, and so on, you can implement a custom property page that plugs into ArcGIS Server Manager and exposes user interface elements more complex than the input text boxes, for example, basic HTML references and dijit form widgets can be embedded in the custom property page.

Custom property pages can require an extensive amount of testing and troubleshooting. The knowledge of web forms development using HTML and JavaScript is desired. In most cases, the default SOI properties illustrated in the above section is sufficient for editing properties. Therefore, before investing your time on developing a custom property page, consider if the default properties illustrated at the SOI default properties section will meet your requirement.

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