Configuring REST services

Feedback


SuperMap iServer provides a visual tool for service configuration and management - iServer Web Manager. Service managers can use this tool to quickly build GIS service contents of various types, and configure forms (e.g., a RESTful form) in which services are published.

The management and configuration of a REST service is completed with the following steps:

Determine the content a REST service

SuperMap iServer provides map REST services, data REST services, realspace REST services, transportation network analysis services, etc., which be published via simple configurations. Therefore the prerequisite of configuring a service is to determine what kinds of REST services are to be provided. Then service modules can be selected accordingly.

GIS services provided in SuperMap iServer all have a multi-level structure. As shown in the graph below, a GIS service contains a provider layer, a Component layer, and an Interface layer. The Interface layer provides a REST Servlet interface for publishing GIS functions in a RESTful fashion. The Provider and Component layers provide service modules with different service contents. REST services with different contents can be created by combining modules with the same service contents in the two layers and configuring the REST Servlet interface. For example, in the figure below, a map REST service is published via the REST Servlet interface after two modules with map operation functions, the Provider module and the Component module, are combined together. A map REST service = {WMSMapProvider, UGCMapProvider}+MapComponent+REST Servlet; a data REST service = {WFSDataProvider, UGCDataProvider}+ DataComponent+REST Servlet; and so forth.

SuperMap iServer provide the GIS services with multi-layer architecture, as shown below, including provider, Component and Interface. Where Interface provides the interface REST Servlet to implement GIS functions and REST publishing. In Provider and Component, they both provide the service modules corresponding different service contents. Configure the REST Servlet interface. SuperMap iServer can build the REST services with different contects. As shown below, Provider module and Component module publish the map REST service through the REST Servlet interface. Map REST service={WMSMapProvider,UGCMapProvider}+MapComponent+REST Servlet; Data REST service={WFSDataProvider,UGCDataProvider}+ DataComponent+REST Servlet and so on.

Configure a service provider or a set of service providers

After the REST service content to be published is determined, the parameters for a service provider or a set of service providers can be configured through the service manager - iServer Web Manager, or through the configuration file - services.xml. If a map REST service is to be published, it is needed to configure service providers of the MapProvider type, such as UGCMapProvider and WMSMapProvider. Similarly, if a data REST service is to be published, it is needed to configure service providers of the DataProvider type, such as UGCDataProvider. Different parameters need to be configured for different types of service providers. For example, suppose UGCMapProvider is to be configured and used to implement map-related operations. If it is to be configured through the configuration file, the configuration should be completed at the node, as shown below:

<provider name="ugcMapProvider1" class="com.supermap.services.providers.UGCMapProvider">

    <config class="com.supermap.services.providers.UGCMapProviderSetting">

        <outputPath>../webapps/iserver/output</outputPath>

        <outputSite>http://localhost:8090/iserver/output/</outputSite>

        <name>default</name>

         <workspacePath>../samples/data/World/World.sxwu</workspacePath>

    </config>

</provider>

where the class ID in <provider> is the implementing class of the UGC service provider; the class ID in <config>, UGCMapProviderSetting, is the configuration class of the UGC service provider; and the content of <config> is the configuration items corresponding to UGCMapProviderSetting:

    <outputPath>: the path of output images.

    <outputSite>: the URI of the root directory for accessing the image.

    <name>: the name of the service provider.

    <workspacePath>: the path of the workspace used by this service provider.

Also, the configuraion of a service provider set is completed at the <providerSet> node.

Please refer to the chapter on service configuration in the online help document for specific methods to configure a service provider (set).

Configure a service component

Parameters for a service component need to be configured once the service provider configuration is done. There are two approaches to configuring a service component: through the service manager, or through the configuration file. When a service component is being configured, information on the service providers it employs also needs to be specified. Additionally, the service provider type (Map, Data, realspace, etc.) specified by a service component must be consistent with that service component. For example, map service providers can only be employed in a map service component.

For example, suppose a service component is to be configured through the configuration file. The configuration is completed at the <component> node. Suppose this is a map service component, the configuration is as follows:

<component name="map-world"

class="com.supermap.services.components.impl.MapImpl" providers="ugcMapProvider-World" interfaceNames="rest,wms111,wms130,wmts100">

    <config class="com.supermap.services.components.MapConfig">

    </config>

</component>

where the class ID of the <component> node is the implementing class of the map component; the providers attribute is the service provider set employed in the map component (see: configure service providers); and the <config> node is the configuration items for this map component.

Configure an interface

On the service interface layer, SuperMap iServer provides a Servlet, REST Servlet, specifically for publishing REST services. REST Servlet can be configured through the service manager or the configuration file. Then GIS services can be published in the form of REST services. If a service interface is to be configured through the configuration file, the configuration should be completed at the node, as shown below:

<interface name="rest" class="com.supermap.services.rest.RestServlet"></interface>

Start service

Under directory %SuperMap iServer_HOME%\bin, batch files are provided for starting up/shutting down a SuperMap iServer server:

After SuperMap iServer is installed using the installation package, shortcuts for starting and stopping a SuperMap iServer service are also available on the Start menu:

A service can also be started using the service manager by clicking on the Start button to the right of Target service examples under the Service tab.