Understanding Services

The MapGuide site performs many different functions. These can be all done by a single server, or you may balance the load across multiple servers. Some essential functions must execute on the site server, while other functions may execute on support servers.

A service performs a particular set of related functions. For example, a resource service manages data in the repository, a feature service provides access to feature data sources, and a mapping service provides visualization and plotting functions.

Before a page can use a service, it must open a site connection and create an instance of the necessary service type. The following example creates a resource service and a feature service:

    $userInfo = new MgUserInformation($mgSessionId);

    $siteConnection = new MgSiteConnection();

    $siteConnection->Open($userInfo);

    $resourceService = $siteConnection->

       CreateService(MgServiceType::ResourceService);

    $featureService = $siteConnection->

       CreateService(MgServiceType::FeatureService);