Connecting to a GIS server


In this topic


Server connection objects

To use the geographic information system (GIS) server to host ArcObjects by your application, the application must connect to the GIS server, that is, connect to the server object manager (SOM). Connections to the GIS server are made through the GISServerConnection object. The GISServerConnection object supports a single interface (in addition to IUnknown) IGISServerConnection. IGISServerConnection has a Connect method that connects the application to the GIS server.
The GISServerConnection object provides connections to the GIS server and access to the ServerObjectManager and ServerObjectAdmin objects. The GISServerConnection object is shown in the following illustration.
You can work with the GIS server using Java. Java has server connection objects that you create to connect to the server. When developing ArcGIS for Server applications using Java, the server connection object can be found in the Server object library.
The following code shows how to connect to a GIS server running on the machine myDomain.
[Java]
new esri.arcgis.server.ServerInitializer.InitailizeServer("myDomain", "myUser", 
    "myPassword");
ServerConnection Connection = newServerConnection();
Connection.Connect "myHost"
If your application is a Web application that uses the ArcGIS for Server Web controls, the Web controls will connect to the GIS server for you, based on the properties you set for the application's MapResourceManager control. For ArcGIS for Server resources, the resource properties includes the name of the GIS server, the name of the MapServer object, and identity properties that assure that the Web application will connect to the GIS server.

agsusers and agsadmin

For a client application to connect to the GIS server, the application must be running as an operating system user that is a member of one of the following two operating system user groups defined on the GIS server machines:
  • ArcGIS for Server users group (agsusers)
  • ArcGIS for Server administrators group (agsadmin)
When applications make connections to the GIS server, they are authenticated against the agsusers and agsadmin user groups on the GIS server as illustrated in the following diagram.
If the user the application is running as is not a member of either of those groups, then Connect will return an error.
In addition to the Connect method, the IGISServerConnection interface has two properties: ServerObjectManager and ServerObjectAdmin. If the application is running as a user in the users or administrators group, the application can access the ServerObjectManager property, which returns the IServerObjectManager interface. The IServerObjectManager interface provides methods for accessing and creating objects within the server for use by applications. The IServerObjectManager interface is shown in the following table.
To access the ServerObjectAdmin property, the application must be running as a user who is a member of the administrators group. If the connected user is not a member of this group, attempts to access the ServerObjectAdmin property will fail. The ServerObjectAdmin property returns the IServerObjectAdmin interface, which provides methods for administering the various aspects of the server, such as server machines. Unless you are writing a GIS server administration application, your application does not need to make use of the IServerObjectAdmin interface.
The ServerObjectManager object provides methods for getting information about the GIS server and for creating server contexts for use by an application. The ServerObjectManager object is shown in the following illustration.
The ServerObjectAdmin object provides methods for administrating the GIS server and its server objects. The ServerObjectAdmin object is shown in the following illustration.
The IServerObjectAdmin interface is shown in the following table.

Impersonation

When connecting to the server using the connection object from a Web application or Web service, you need to consider impersonation. Your Web application or Web service must connect to the GIS server as a user in the users group. To do this, your Web application or Web service must impersonate such a user. If you do not use impersonation, your Web application or Web service will attempt to connect to the GIS server with the identity of the Web server's worker process.