ASP Store Locator Sample for MapPoint Web Service

 

IMPORTANT: MapPoint Web Service was retired on November 18, 2011. Please see Bing Maps for a list of current Bing Maps APIs.

Joe D. Como
Microsoft Corporation

August 2004

Applies to:
   Microsoft MapPoint Web Service, Version 3.5

Summary: Learn how to install and run a store locator application created with Active Server Pages (ASP) that uses Microsoft MapPoint Web Service. (4 printed pages)

Click here to download the code sample for this article, and click here for the installation instructions.

Contents

Introduction
Requirements
Installing the ASP Store Locator
Conclusion

Introduction

Active Server Pages (ASP) was not designed to consume Web services, such as Microsoft MapPoint Web Service, because Web services did not exist when ASP was created. On the other hand, MapPoint Web Service specifically takes advantage of the advances that came with ASP.NET and the Microsoft .NET Framework. But many companies are still using older versions of ASP and cannot convert their applications to ASP.NET. In recognition of this fact, we created an ASP Store Locator sample application that works with MapPoint Web Service.

The ASP Store Locator uses sample data for a fictional company called Fourth Coffee Company. The application can geocode an address or place that a user inputs and perform a proximity search for nearby locations that are stored in the MapPoint Fourth Coffee sample data source. Users can then have the Store Locator calculate driving directions or show a detailed map for any of the locations that are returned by the proximity search. You can customize the ASP Store Locator to include your own branding images and make queries against data that you have uploaded to the MapPoint Web Service Customer Service site (CSS).

Note   You must be a MapPoint Web Service customer to access the CSS. For more information about MapPoint Web Service or to sign up for an evaluation account, visit the MapPoint Web Service Web site.

The ASP Store Locator consists of ASP files, which provide the user interface, and Microsoft Visual Basic class files, which are compiled into a DLL (using Visual Basic 6.0 with Service Pack 5) and provide the underlying functionality. The SOAP Toolkit is used to generate a Web Services Meta Language (WSML) file that maps the operations of MapPoint Web Service described in the MapPoint Web Service Web Services Description Language (WSDL) file to specific methods in the COM object (the DLL). The WSML file determines which object to load in order to service the request for each operation.

Requirements

Before installing the ASP Store Locator, you must have the following software installed on your computer:

  • Internet Information Services (IIS) 5.0 with the latest security updates
  • Microsoft Windows 2000 Server, Windows XP Professional, or Microsoft Windows Server 2003
  • Microsoft SOAP Toolkit 3.0
  • Microsoft Visual Basic 6.0 with Service Pack 5

You also need a valid MapPoint Web Service account. For more information about MapPoint Web Service or to sign up for an evaluation account, visit the MapPoint Web Service Web site.

Installing the ASP Store Locator

After installing the prerequisite software, you can install the ASP Store Locator.

To install the Store Locator

  1. Download ASPGeneric.exe, and then run Setup. (By default, Setup starts automatically after you unzip the files contained in ASPGeneric.exe.)
  2. Navigate to the installation folder specified during setup (the default is C:\Program Files\Store Locator using ASP), double-click ASPGeneric.exe, and then unzip the files contained in the executable.
  3. Create two folders at the same level on your computer. One folder will hold the ASP files and images for the application and the other folder will hold the DLL, the WMSL file, and the WSDL file.
  4. Configure the folder for the ASP files as follows, and then copy the contents of the Asp folder that you just unzipped into this folder:
    • Right-click the folder, click Properties, and then click the Web Sharing tab.
    • Click Share this folder, and, in the Edit Alias box, under Application permissions, make sure that Scripts is selected.
    • Click OK, and then click Apply.
  5. Copy the following files from the MapPointTypeMappers folder that you just unzipped into the second folder:
    • MapPointTypeMappers.dll
    • MapPoint.wsdl
    • MapPointSoapServices30.wsml
  6. Use RegSvr32.exe to register MapPointTypeMappers.dll:
    • Open a command prompt, change the directory to the one that contains the DLL, and then type the following line:

      regsvr32 MapPointTypeMappers.dll
      
  7. In the folder that holds the ASP files, use a text editor to open the Constants.asp file, replacing the default values for the following constants:
    • MAPPOINT_USER_ID—your MapPoint Web Service user name
    • MAPPOINT_PASSWORD—your MapPoint Web Service password
    • MAPPOINT_WSDL_URL—the path to the MapPoint.wsdl file that you copied to your computer
    • MAPPOINT_WSML_FILE—The path to the MapPointSoapServices30.wsml file that you copied to your computer
    • LOCATOR_LOG_FILE—The path to the file in which a log of your transactions will be recorded

At this point, the application should be running. To test the application, open a Web browser and type the URL for the folder containing the ASP files (http://localhost/YourFolderName). If you do not see the first page of the application, you may need to modify some security settings of your Web server.

To modify security settings

  1. In Internet Information Services Manager, configure IIS to allow anonymous access through the IUSR_YourServerName account and allow IIS to control the password.
  2. Grant the IUSR_YourServerName account Read access to the folder where the MapPointTypeMappers.dll file is located.
  3. Grant the IUSR_YourServerName account Read and Write access to the folder to which the log will be written.
  4. Use Regedit.exe to grant the IUSR_YourServerName account Read access to the HKEY_CLASSES_ROOT\Interface and HKEY_CLASSES_ROOT\TypeLib keys in the registry.

**Caution   **Incorrectly editing the registry can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from editing the registry incorrectly can be resolved. Before editing the registry, back up any valuable data.

After changing your configuration settings, you can view the application in the following ways:

  • Regular interface—Accessible at http://localhost/YourFolderName/default.asp
  • Pocket PC interface—Accessible at http://localhost/YourFolderName/PPCInputForm.asp
  • Banner ad interface—Accessible at http://localhost/YourFolderName/banner.html. This page shows an HTML form superimposed over a banner graphic.

Conclusion

ASP is a legacy platform, and it is not a simple task to take advantage of current technologies, such as Web services, and consume them with ASP. With this ASP Store Locator, however, the basics of how to interact with MapPoint Web Service are provided for you. And you can expand this application to accommodate your individual requirements. If upgrading to ASP.NET is not possible, this sample code provides a good basis on which to build your application.

Joe D. Como is a Web Development Engineer in the Microsoft MapPoint Business Unit and is a member of the Professional Services team.