While MapPoint 2004 and MapPoint Web Service both provide APIs to understand location information and process location data, Microsoft Location Server provides an ability to integrate real-time location into your application to provide location-based applications and services; to that end, Microsoft Location Server transcends into a real-time location platform that answers the basic question “Where am I?”
Location-based services are provided to a user based on his real-time location and can range from a simple service, such as listing nearby restaurants, to more complex features, such as analyzing real-time traffic conditions and finding the least congested route to a destination. For location-based services to work, a locatable device, such as a wireless mobile device or a pager, is usually necessary to identify the user’s geographical location. In essence, location-based services are all about identifying the best and nearest possible service based on where the user currently is.
Developing location-based services conventionally is tedious and expensive because GPS hardware and software are required. However, with the Microsoft Location Server, you don’t need a GPS device to find your real-time location; you can find your location (or your customer’s location) using a mobile phone number.
In this chapter, I will discuss the inner workings of the Microsoft Location Server in detail; at the end I will go over the installation process of the Microsoft Location Server before tackling the programming aspects in the next chapter.
Before I get into the details of how Microsoft Location Server works, you’ll need to familiarize yourself with the following terminology :
A company that provides communication services for mobile devices, such as cell phones and pagers. For example, in the United States, some companies that provide mobile communication services, such as Sprint, Verizon, and Nextel, fall into this category.
Provisioning is the process of registering an enterprise user with Microsoft Location Server. A user who is registered with Microsoft Location Server is called a provisioned user. Each provisioned user must have an associated mobile device number (or phone number) that can be used by the mobile operator to identify the user’s real-time location.
A provider is a software plug-in for Microsoft Location Server developed to communicate with a specific network carrier, such as a cell phone company, either to obtain the location of a mobile device or to send a Short Message Service (SMS) message to a mobile device. Providers used for getting the location of a mobile device are called location providers , and providers used for sending SMS messages are called notification providers . Location and notification providers are unique to each mobile operator, and this is where the value of the Microsoft Location Server comes into the picture—it eliminates the carrier-specific complexity and provides an aggregated set of APIs for the developers to build applications.
A locatable contact is a provisioned user who can be contacted by another provisioned user within an enterprise.
With this introduction to the key terminology used in Microsoft Location Server, let’s see how it works to obtain real-time location from the cellular phone networks.
Microsoft Location Server does not require GPS-like hardware to get real-time locations; instead, it locates a provisioned user’s mobile device by communicating with a mobile operator. In a typical scenario, a user requests her position using a client that communicates with Microsoft Location Server; this client can be a mobile phone (such as a SmartPhone) or a portable computer (such as a laptop).
When Microsoft Location Server receives the request from the client, it identifies the mobile operator for the user and sends a location request to the mobile operator. The mobile operator responds by sending back the real-time location of the user, expressed as latitude and longitude coordinates. Microsoft Location Server then returns that location to the user’s client, where it can be used for rendering a map or finding nearby points of interests, depending on the application. All communications that are specific to a mobile operator are hidden from end users and developers. Thus, Microsoft Location Server works as an aggregator for mobile operators by abstracting implementation details specific to the mobile operator to obtain a real-time location. Figure 9-1 summarizes this process.
One important thing to keep in mind is that the accuracy of the locations returned by the Microsoft Location Server depends on the mobile operators and methods used to locate the devices on their networks. For example, some cell phone carriers use cell tower triangulation technique to determine the location of a phone; in this method the phone’s location is determined by the cell towers around it. As you can imagine, this method does not always yield an accurate location. Some carriers use an assisted GPS technique, which results in a very accurate location of the phone. Table 9-1 provides an overview of technologies used by different network carriers and the approximate location accuracy of each technique used.
Now that you know how Microsoft Location Server works in general, let’s look at the internals to understand its architecture.
Microsoft Location Server consists of three core components :
In this section, I will go through each one in detail.
Microsoft Location Server Web Service is a programmable web service that developers can use to build real-time location client applications for a variety of platforms, including Microsoft Windows, the Web, and mobile devices. This web service exposes an API for finding the real-time locations of users and their contacts, finding points of interest, and managing contacts. Unlike MapPoint Web Service, which is hosted by Microsoft, Microsoft Location Server Web Service is hosted within your enterprise. In order to host this web service, you need Internet Information Server (IIS) 5.0 or higher, along with Secure Socket Layers (SSL).
It is important to note that Microsoft Location Server Web Service is always hosted with Secure Socket Layers (SSL) enabled to mitigate privacy-related issues while communicating the real-time location over the wire. Due to this precaution, to communicate with Microsoft Location Server Web Service, your client (Pocket PC, Pocket PC emulator, or development computer) must be able to establish a trusted connection via SSL. A client can establish a trusted connection when MapPoint Location Web Service is deployed with a root certificate issued by authorities such as Verisign, Cybertrust, Thawte, or Entrust. However, during development, if Microsoft Location Server Web Service is deployed using a certificate generated by your enterprise, you must install the certificate on the client manually.
The Microsoft Location Server database is a Microsoft SQL Server 2000 database used for storing information about provisioned users, contacts, and mobile operators, along with data related to points of interest (Find Nearby) categories. Microsoft Location Server exposes a set of management APIs for performing tasks such as provisioning users, managing contacts, and managing Find Nearby categories.
You’ll need SQL Server 2000 with Service Pack 3 (SP3) or later to install the Microsoft Location Server database.
Microsoft Location Server providers are software plug-ins required for communication with mobile operators. Usually, there is a location provider and a notification provider for each mobile operator. Because the implementation of location and notification providers is unique to each mobile operator, Microsoft Location Server does not currently expose APIs for developing location or notification providers.
The Microsoft Location Server includes a demonstration location provider for testing purposes. This demo provider simulates real-time location scenarios against a configurable file with phone numbers and associated latitude and longitude pairs.
For more information about the demo provider, see the Microsoft Location Server Administrator’s Guide, Version 1.0, which is included with Microsoft Location Server.
Figure 9-2 shows how all the core components work together to obtain the real-time location of a mobile device.
Now that you know the core components of the Location Server and how they work together, let’s look at how to install the Location Server within your enterprise.
In a production environment, Microsoft Location Server components should be distributed among multiple computers for security reasons; however, when you are developing and testing Microsoft Location Server applications, you may want to install all the components on a single computer. In this section, we’ll see how to set up your Microsoft Location Server environment and install Microsoft Location Server on a single computer for development and testing.
For the latest version of the Microsoft Location Server, go to http://go.microsoft.com/fwlink/?linkid=25704.
To use Microsoft Location Server, you also need a valid MapPoint Web Service account. For more information about MapPoint Web Service or to sign up for a MapPoint Web Service evaluation account, visit the MapPoint Web Service web site at http://www.microsoft.com/mappoint/products/webservice/default.mspx.
To install Microsoft Location Server , you need Microsoft Windows Server 2003, Standard Edition in a new Active Directory domain as your web server and Microsoft SQL Server 2000 as the Microsoft Location Server database.
For a complete list of Microsoft Location Server prerequisites, see Chapter 2, Installing Microsoft Location Server, in the Microsoft Location Server Administrator’s Guide.
The installation process consists of four primary tasks, each with a number of subtasks. The four primary tasks are:
Install and configure Windows Server 2003, Standard Edition.
Install and configure SQL Server 2000 Developer Edition and apply the latest service pack (SP3a).
Generate a Secure Sockets Layer (SSL) certificate and configure Internet Information Services (IIS) for SSL.
Install and configure Microsoft Location Server and verify your installation.
Microsoft Location Server requires you to preconfigure Windows Server 2003, SQL Server 2000, and Internet Information Server with SSL before installing the Location Server itself.
For detailed information and step-by-step instructions for preconfiguration and installation, go to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmaploc/html/MLSSetup.asp?frame=true.
Once you successfully install Microsoft Location Server, there are two kinds of applications you can develop:
Using the Location Web Service that you installed, you can build real-time location applications using mobile devices provisioned within your enterprise.
Using the Location Server APIs, you can build applications to manage users, contacts, and providers and to find nearby points of interest.
In the following sections, I will outline how to access both location web service APIs and server APIs once the Microsoft Location Server is installed.
Microsoft Location Server Web Service allows you to develop real-time location-based services, such as finding your exact location or locating your contacts’ exact locations. This web service also provides API functionality to manage contacts and privacy settings for any given provisioned user, making programming with Microsoft Location Server Web Service no different from programming with any web service.
Once you have successfully installed Microsoft Location Server, you can access the Location Server Web Service APIs using the following URL:
https://YourFullDomainName/mmlsservice/locationserver.wsdl |
The Location Server Web Service is hosted by your enterprise on your full domain name that is only accessible via any valid provisioned enterprise user credentials. To program with this web service, you can either use WSDL.EXE or Visual Studio .NET (2003 or later) to generate .NET proxy classes that can be added as references to your project.
If you are planning to develop applications using mobile devices such as PocketPC or SmartPhone, your client should be able to trust the (SSL) certificate presented by the server hosting the Location Server Web service. Read the following knowledge base article to add a root certificate manually: http://support.microsoft.com/default.aspx?scid=kb;en-us;322956.
Using the Microsoft Location Server server-side APIs, you can develop a variety of applications that can be run on any Microsoft Location Server; it is important to keep in mind that the applications developed using the Server APIs are purely Microsoft Location Server administrative applications and are not related to any real-time location scenarios. Administrative applications for Microsoft Location Server can be categorized into four major categories:
Adding (provisioning ) new users, updating/removing existing users, and so on.
Adding new contacts, updating current contacts, and removing old contacts for the provisioned users.
Managing your enterprise-level privacy settings programmatically, including setting notification modes for provisioned users and setting contact level locatable permissions.
This category of applications allows you to manage the find nearby categories that can be enabled for finding nearby points of interest. Usually enterprises are required to add, update, and delete the find nearby categories specific to their business needs and the Server API provides a way to programmatically manage them.
Keep in mind that all of the above-mentioned functionality is already available via the Microsoft Management Console (or MMC) for the Microsoft Location Server ; however, there may be instances where you need to write scriptable applications as part of the Location Server administration, which is where the Server APIs will come in handy.
To build such applications, how do you access Location Server APIs ? When you install the Microsoft Location Server successfully, you will see the following Location Server Management APIs installed as part of the server installation:
MS.LocationServer.Types.dll
This assembly contains all the Location Server data types, such as LocatableUser and LocatableContact.
MS.LocationServer.Management.dll
This assembly contains all of the classes that provide methods to manage the Location Server, including the ServerAPI class containing all of the management methods.
MS.LocationServer.Core.dll
This assembly contains classes required by the management API types. It should only be used to add as a reference to your project; you should never have to use the types from this assembly directly in your source code.
To develop Location Server applications, copy the aforementioned assemblies to your development machine and either add them to your local Global Assembly Cache or copy them to your local application Bin folder.
Additionally, to develop Location Server Applications, you also need sufficient privileges to access the Location Server Database. You also should have an SSL root certificate on your development computer to establish a more secure connection to the computer running SQL Server. Note that in the Microsoft Location Server environment, the database server is configured with Microsoft Windows authentication mode. Your enterprise domain alias should have proper access rights to connect to the Microsoft Location Server Database.
Finally, to successfully run a Location Server management
application, the account running the application must be a member of
the MLSADMINISTRATORS
security
group.
Before we cover the detailed programming aspects of the Microsoft Location Server, Table 9-2 shows a list of mobile network providers that are enabled to work with Microsoft Location Server in various countries.
Country/Region | Mobile network providers |
United States | Nextel, Sprint |
Canada | Bell Mobility |
Nordic and Baltic regions | Telia Sonera |
Western Europe | Teydo |
There are currently many other mobile network providers working with Microsoft to enable locating via Microsoft Location Server.
You can visit http://www.microsoft.com/mappoint/products/locationserver/operators.mspx for an up-to-date list of providers who work with Microsoft Location Server.
In this chapter, we have looked at the architectural details of the Microsoft Location Server and how it works to obtain real-time location of a mobile device from the mobile carrier networks. The real-time location web service is hosted within an enterprise (not by Microsoft). Location Server also provides Server Management APIs for administrative application development, such as user management, contact management, and privacy management.
Next, let’s look at programming with Location Service APIs and Location Server Management APIs in detail.
3.149.249.252