Skip To Content

将 10.0 Java 服务器对象扩展迁移至更高版本

使用 ArcGIS 10.1 开发的 Java 服务器对象扩展 (SOE) 可用于 10.2 及更高版本中。但是,将 ArcGIS Server 10.0 开发的 SOE 迁移至 10.1 及更高版本时需要对 SOE 的源代码进行一些修改。本主题探讨了所需修改并介绍了用于导出 Java SOE 的新 Eclipse 向导。其中还解释了 ArcGIS 10.1 版本以及更高版本中为何没有 SOEManager 工具。

  1. 修改 SOE 的 ServerObjectExtProperties Java 注记。

    使用 Eclipse SOE 创建向导创建 SOE 时,生成的代码包括一个称为 ServerObjectExtProperties 的 Java 注记,用于保存 SOE 的元数据。在 ArcGIS 10.0 中,此注记具有以下属性:

    • displayName — SOE 简明易懂的显示名称
    • description — SOE 的多行描述
    • defaultSOAPCapabilities 和 allSOAPCapabilities — SOE 的功能
    • properties — SOE 的属性,如“名称 = 值”对
    • supportsMSD — 用于指示 SOE 支持基于 MSD 的服务的标记

    在 ArcGIS 10.1 以及更高版本中,引入了基于服务定义的地图服务,因此不再需要 supportsMSD 属性,已将其移除。所有其他属性保持不变。因此,必须将 ArcGIS 10.0 Java SOE 的 ServerObjectExtProperties 注记修改为以下形式,才能在 ArcGIS 10.1 及更高版本中工作:

    @ServerObjectExtProperties(displayName = "Simple REST SOE", 
    	description = "My Simple REST Server Object Extension.",
    	defaultSOAPCapabilities = "", allSOAPCapabilities = "", 
    properties = "")
  2. 修改 SOE 以使用 ArcGIS Server 10.1 及更高版本的地图或影像服务。

    ArcGIS 10.1 及更高版本不支持直接基于 MXD 文档的地图或影像服务;而是在后台中使用服务定义。

    因此,在 ArcGIS 10.1 及更高版本中,将使用 com.esri.arcgis.carto.IMapServerDataAccess 接口来访问通过地图或影像服务提供的图层。以下代码片段演示了如何处理通过基于服务定义的地图服务显示为图层的要素类:

    IServerObjectHelper soh = . . .; //accessible to SOEs at runtime
    IMapServerDataAccess mapServerDataAccess = (IMapServerDataAccess)soh.getServerObject();
    IMapServer3 ms = (IMapServer3) mapServerDataAccess;
    String mapName = ms.getDefaultMapName();
    int layerId = . . .;//integer id of the feature layer you are interested in accessing
    FeatureClass fc = new FeatureClass(mapServerDataAccess.getDataSource(mapName, layerId));