ArcGIS Server APIs
SOAP
1)XML-structured
语言。
2)
对
server objects
和
server object extensions
可用。
3)
设计用作
stateless
交互。
4)Catalog
请求由
IServerCatalogAdmin
接口处理。
5)Service
请求由
IRequestHandler
接口处理。
ArcObjects
1)
远程与
GIS Server
上的
ArcObjects
交互。
2)
使用客户端的
Primary Interop Assemblies (PIA)
和
object libraries
。
3)
通过
SOM
访问获得
ArcGIS Server services
。
4)
设计用作
stateless
和
stateful
交互。
ArcGIS Server MapResource 类型
A 、 MapResourceInternet – 连接到 Web service endpoint
B 、 MapResourceLocal – 连接到 Server Object Manager
1) 访问 ServerContext
2) 使用 ArcObjects
ArcGIS Server Internet: SOAP 编程
1)MapResourceInternet
MapServerProxy, 访问 value objects
2) 通讯是 stateless
3) 使用 pooled objects
Dim mapRes as ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceInternet
mapRes = gisFunc.Resource
Dim mapsProxy as ArcGISServer.MapServerProxy = mapRes.MapServerProxy
Dim mapInfo as ArcGISServer.MapServerInfo =
mapsProxy.GetServerInfo(mapsProxy.GetDefaultMapName())
Dim mapDesc as ArcGISServer.MapDescription = mapInfo.DefaultMapDescription
Dim mLayerInfo as ArcGIServer.MapLayerInfo()
mLayerInfo = mapRes.MapServerInfo.MapLayerInfos
Dim layerDescs as ArcGISServer.LayerDescription()
layerDescs = mapDesc.LayerDescriptions
ArcGIS Server Local: ArcObjects 编程
1) 远程访问 ArcObjects
2)MapServerLocal
MapServer > IMapServer (COM) >IMapServerObjects (COM)
3) 通过 .NET 部件访问高级的 functionality
Dim mapFunc as IMapFunctionality = Map1.GetFunctionality(0)
Dim ags_mr as ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal
ags_mr =
CType(mapFunc.Resource,ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal)
' Access the ArcObjects COM ServerObject directly
Dim mapServer as ESRI.ArcGIS.Carto. IMapServer = CType(ags_mr.MapServer,IMapServer)
Dim mapServerObjs as ESRI.ArcGIS.Carto.IMapServerObjects
mapServerObjs = CType(mapServer,IMapServerObjects)
Dim map as ESRI.ArcGIS.Carto.IMap = mapServerObjs.Map
' Now perform more ArcObjects operations
Dim featClass as IFeatureClass = CType(map.Layers(0)).FeatureClass,
深入 ArcGIS Server Local API
1)MapResourceLocal
通过 DCOM 访问 server 上的 ArcObjects
ServerContext
2) 所有的过程在远程完成
ArcObjects 远程编程
1) 能在服务器上创建新的对象
2)MapServerLocal
ServerContextInfo
ServerContext
3) 不需要 release servercontext
Dim ags_mr as ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal
ags_mr =
CType(qfunc.Resource,ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceLocal)
' Create a new ArcObjects COM objects
Dim context as ESRI.ArcGIS.Server.IServerContext = ags_mr.ServerContextInfo.ServerContext
Dim pnt as ESRI.ArcGIS.Geometry.IPoint = context.CreateObject("esriGeometry.Point")
pnt.X = 60
pnt.Y = 100
Dim topo as ESRI.ArcGIS.Geometry.ITopologicalOperator = CType(pnt, Itopological)
常用开发模式
--首先建立连接 Identity identity = new Identity("username", "pwd", "domain"); AGSServerConnection connection = new AGSServerConnection("fmc-pca187", identity); connection.Connect(); --获得服务器对象 IServerObjectManager m_pSOM = connection. ServerObjectManager ; IServerContext m_pServerContext = m_pSOM. CreateServerContext (" testMap" , "MapServer" ) ; IMapServer pMapServer = m_pServerContext . ServerObject as IMapServer ; --使用服务器对象 IMapServerObject s pMapServerObject s = ( IMapServerObject s) pMapServer ; IMap pMap = pMapServerObject s. get_Map (pMapServer .DefaultMapName) ; IFeatureLayer p FLayer = ( IFeatureLayer) pMap. get_Layer(0) ; IFeatureClass p FeatureClass = p FLayer . FeatureClass ; int i = p FeatureClass. FeatureCount (null) ; --释放服务器对象 m_pServerContext . ReleaseContext () ;