Loading

ArcGIS Server SOE 开发

ArcGIS Server SOE 开发

Library描述
Carto提供使用 MapServer 的关键接口。您将找到图层、表的界面以及有关地图服务的信息,例如范围和比例信息。它也是访问基础数据的起点。
DataSourcesFile通常,您将访问服务已引用的数据,但如果您需要打开独立于服务的基于文件的矢量数据,则此库可能会有所帮助。它可用于打开工作空间(与文件的连接)到 shapefile、TIN、CAD 文件等。引用数据集后,可以使用地理数据库库访问要素。
DataSourcesGDB通常,您将访问服务已引用的数据,但如果您需要打开独立文件地理数据库、SQLite 数据库或企业级地理数据库,则此库允许您这样做。引用数据集后,可以使用地理数据库库访问要素。
DataSourcesRaster通常,您将访问服务已引用的数据,但如果您需要打开服务未引用的栅格数据,则此库允许您这样做。
Geodatabase无论您是通过服务引用了数据,还是使用其中一个数据源库打开了数据,您都可以通过地理数据库库访问数据(要素和栅格)。
GeodatabaseDistributed通常,您将将其用于拦截 WFS 请求的 SOI。
GeodatabaseExtensions包含用于帮助创建、管理和使用 terrain 数据集和地籍结构的对象。
Geometry提供用于处理特征几何的接口和功能。
GISClient提供对对象的访问,以便使用远程地理信息系统 (GIS) 服务。
Server主要用于获取有关 ArcGIS Server 的信息并执行管理操作,例如查询日志。
System提供所有其他库引用的基本类和接口。ArcGIS Enterprise SDK 开发人员通常会使用它来处理 REST 和 SOAP 请求。

开发环境安装

参考

1. 安装 ArcGIS Enterprise SDK

2. 安装 Java 和 Maven

3. 安装 Maven artifacts(本地仓库)

4. 安装 Java IDE (可以使用 IDEA )

Java

Maven 集成

参考:Maven 集成概述

1. 依赖安装?

使用ArcGIS Enterprise SDK 自带的 install-maven-artifacts 工具(install-maven-artifacts.bat,将 SDK 所需的 Maven 依赖项、原型和插件安装在 Maven 本地存储库中。

cd "C:\Program Files\ArcGIS\EnterpriseSDK\Java\maven"
install-maven-artifacts.bat

这六项:arcgis-enterprise-sdksdk-pluginrest-soe-archetypesoap-soe-archetyperest-soap-soe-archetypesoi-archetype 应成功安装,并且每个项的“构建成功”状态都应为“构建成功”

  • arcgis-enterprise-sdk:文件包含 SOE 或 SOI 将使用的所有 ArcGIS 库。通过原型创建SOE项目时,自动将此依赖添加到 poe.xml 中
<build>
    <plugins>
        <plugin>
            <groupId>com.esri.arcgis.enterprise.sdk</groupId>
            <artifactId>sdk-plugin</artifactId>
            <version>11.3</version>
            <dependencies>
                <!-- Include any additional plugin dependencies here if needed -->
            </dependencies>
            <configuration>
                <configProp>
                    <Version>1.0</Version>
                    <Author>AuthorName</Author>
                    <Company>CompanyName</Company>
                    <TARGETS>10.9</TARGETS> <!-- Required -->
                </configProp>
            </configuration>
            <executions>
                <!--The following execution is required in SOAP SOE-->
                <!--execution>
                    <id>generate-wsdl-goal</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>generate-wsdl</goal>
                    </goals>
                </execution-->
                <execution>
                    <id>package-soe-goal</id>
                    <phase>package</phase>
                    <goals>
                        <goal>package-soe</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
  • sdk-plugin: 在项目生成期间打包并在项目的目标文件夹中生成 .soe 文件(和附加的.wsdl文件)(SOAP SOE 必须安装此依赖, REST SOE 不需要?)
<build>
    <plugins>
        <plugin>
            <groupId>com.esri.arcgis.enterprise.sdk</groupId>
            <artifactId>sdk-plugin</artifactId>
            <version>11.3</version>
            <dependencies>
                <!-- Include any additional plugin dependencies here if needed -->
            </dependencies>
            <configuration>
                <configProp>
                    <Version>1.0</Version>
                    <Author>AuthorName</Author>
                    <Company>CompanyName</Company>
                    <TARGETS>10.9</TARGETS> <!-- Required -->
                </configProp>
            </configuration>
            <executions>
                <!--The following execution is required in SOAP SOE-->
                <!--execution>
                    <id>generate-wsdl-goal</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>generate-wsdl</goal>
                    </goals>
                </execution-->
                <execution>
                    <id>package-soe-goal</id>
                    <phase>package</phase>
                    <goals>
                        <goal>package-soe</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

2. 通过原型创建SOE项目

如下命令,可以创建REST SOE 项目,其中 DarchetypeVersion=10.9.1表示版本为 10.9.1:

mvn archetype:generate -DarchetypeGroupId=com.esri.arcgis.enterprise.sdk -DarchetypeArtifactId=rest-soe-archetype -DarchetypeVersion=10.9.1

如果要创建没有交互性的 SOE 项目,可以添加 -DinteractiveMode=false 或者 -B 设置,如下所示,将所有属性添加到命令行中,无需逐个设置:

mvn archetype:generate -B -DarchetypeGroupId=com.esri.arcgis.enterprise.sdk -DarchetypeArtifactId=rest-soe-archetype -DarchetypeVersion=10.9.1 -DsoeName=TestSimpleRESTSOE -DgroupId=com.soe.demo -DartifactId=SimpleRESTSOEDemo -Dversion=1.0

使用 IDEA:
文件-新建-项目- Maven Archetype - 目录(默认本地)

加载本地配置

Manager => 地图服务里的SOE,启用之后,可以设置配置文件路径。

soe 文件的压缩包,Config.xml 是否可以设置默认值?

更新版本

开发

SOE开发介绍,比较详细

SOE属性(可以用于设置配置目录)

添加日志模块

slf4j报错:

public static boolean ResetLogConfig(String logConfigPath, String[] msgs) {
		try{
			LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
			JoranConfigurator configurator = new JoranConfigurator();
			configurator.setContext(loggerContext);
			File configFile = new File(logConfigPath);
			if (configFile.exists()) {
				configurator.doConfigure(configFile);
				return true;
			} else {
				msgs[0] = "指定的logback.xml文件不存在";
			}
		}catch (Exception ex){
			msgs[0] = "加载日志配置文件失败!" + ex.toString();
		}
		return  false;
	}

在执行转换的时候(LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory()

使用高版本的logback,会提示找不到jar包?

java.lang.ClassCastException: class org.slf4j.helpers.NOPLoggerFactory cannot be cast to class ch.qos.logback.classic.LoggerContext (org.slf4j.helpers.NOPLoggerFactory is in unnamed module of loader 'app'; ch.qos.logback.classic.LoggerContext is in unnamed module of loader com.esri.arcgis.discovery.servicelib.impl.SOThreadClassLoader @1f388140)
	public void test3() throws IOException {
		try {
			Class<?> loggerFactoryClass = StaticLoggerBinder.getSingleton().getLoggerFactory().getClass();
			// 获取ProtectionDomain
			ProtectionDomain protectionDomain = loggerFactoryClass.getProtectionDomain();
			if (protectionDomain!= null) {
				// 获取CodeSource
				CodeSource codeSource = protectionDomain.getCodeSource();
				if (codeSource!= null) {
					// 获取jar包的URL
					URL jarLocation = codeSource.getLocation();
					serverLog.addMessage(3, 200,"加载类所在的jar包位置: " + jarLocation.getPath());
				} else {
					serverLog.addMessage(3, 200,"无法获取CodeSource,可能类不是从jar包加载的。");
				}
			} else {
				serverLog.addMessage(3, 200,"无法获取ProtectionDomain。");
			}
			java.net.URL url = loggerFactoryClass.getResource(loggerFactoryClass.getSimpleName() + ".class");
			if (url!= null) {
				serverLog.addMessage(3, 200,"类 " + loggerFactoryClass.getName() + " 所在文件位置: " + url.getPath());
			} else {
				serverLog.addMessage(3, 200,"无法获取类文件位置。");
			}
			Package implementationPackage = loggerFactoryClass.getPackage();
			String version = implementationPackage.getImplementationVersion();
			if (version!= null) {
				serverLog.addMessage(3, 200,"SLF4J当前绑定的实现类 " + loggerFactoryClass.getName() + " 的版本号是: " + version);
			} else {
				serverLog.addMessage(3, 200,"无法获取实现类的版本号,可能未在MANIFEST.MF文件中设置。");
			}
		} catch (NoClassDefFoundError e) {
			serverLog.addMessage(3, 200,"未找到绑定的日志实现类,可能是配置错误或者没有正确引入依赖。");
		} catch (AutomationException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

arcgis-soe-log_1.png

GeoScene Server 使用 Wine ?

soe压缩的jar包在这个目录下

/home/geoscene/geoscene/server/framework/runtime/.wine/drive_c/users/geoscene/AppData/Local/ESRI/Server11.0/EntAssemblyCache/{29EA19F1-0589-481C-BEC4-82AB7C5A3764}

工具发布(基于ArcGIS Pro)

https://pro.arcgis.com/en/pro-app/latest/tool-reference/server/an-overview-of-the-publishing-toolset.htm

参考

ArcGIS Enterprise SDK
开发相关的系统要求

Java simple REST SOE sample
How to create and develop a Java REST SOE

使用 IntelliJ 构建 REST SOE

将 ArcObjects 扩展模块迁移到 ArcGIS Enterprise SDK

调试SOE扩展(远程端口)

服务器目录

API All Classes

posted @ 2025-04-03 11:21  一起滚月球  阅读(48)  评论(0)    收藏  举报