Investigating the MapPoint Web Service 3.5 SDK
We take a look at getting started with the MapPoint Web Service including how to obtain an evaluation account, set up your computer with the right software, and run the Core Functionality samples both on your local computer and an ASP.NET web server
Introduction. I started playing the the MapPoint Web Service SDK this month for what is now the third time in the couple of years that the MapPoint Web Service (originally known as MapPoint .NET) has been available.
The marketing effort and support behind the MapPoint Web Service has only seemed to increase over the years unlike the MapPoint desktop product, and the sustained push by Microsoft gives the impression this is a product that will only increase in importance.
The intention of this article is to outline my investigations with the MapPoint Web Service SDK, highlight some great finds, share any snafus, and basically go through some of the technical steps in running the samples locally, and the steps in publishing an ASP.NET solution to the web.
Platform. I am using a Windows 2000 Professional (service pack 4 with all Windows Updates) laptop and Visual Studio .NET 2003. I installed IIS 6.0 (Control Panel | Add/Remove Programs | Add/Remove Windows Components) and the .NET Framework 1.1 Redist Pack (23 MB).
The last thing that's needed is to download and install the MapPoint Web Service SDK 3.5 (8 MB). The SDK comes with 16 sample Visual Studio projects (32 if you count both Visual Basic and Visual C#) and the premise of this article is to simply execute and share the results of running the Core Functionality samples.
Testing. With this platform, the only remaining steps the should be needed to open and execute the samples is to insert valid credentials into the web.config file and create an IIS virtual directory pointing to the solution. Interestingly, Microsoft made available some valid credentials set to expire April 30th in a reviewer's guide (page 16-17) at the MapPoint Web Sevice Virtual Pressroom. Typically you can apply for 45-day evaluation credentials via this form and wait 2-3 days for approval.
Creating a virtual directory is very easy, simply right-click on the "Default Web Site" in the Internet Services Manager found in the Administrative Tools and select new Virtual Directory pointing to the folder containing the sample you wish to execute.
At this point I tried opening a project and Visual Studio reported that ASP.NET version 1.1 was not installed, specifically: "Visual Studio .NET has detected that the specified Web server is not running ASP.NET version 1.1. You will be unable to run ASP.NET Web applications or services." Searching around on the web I found a number of references to a knowledge base article (306005) from people saying that they'd tried the steps listed there and it did not work. All I can say is that the fix ? using aspnet_regiis.exe -i ? did the trick for me.
Samples. I started with the Core Functionality samples. After creating a FindCS virtual directory, I could open "FindCS.csproj" in Visual Studio. First, set the start page by right-clicking on Find.aspx and "Set as Start Page". Also, update the MapPointService web reference, again by right-clicking. (If you skip the steps above, there will be some friendly, easy-to-follow, error messages and instructions to resolve the problem. Finally, going to Debug | Start executes the project and brings up Internet Explorer with the Find samples.
I found that opening the project in Visual Studio would take approximately 25 seconds and executing the project could take up to a minute on my laptop (600 Mhz). Here's a screenshot of the Find sample.
The FindVB projects is opened and executed the same way, as we have not delved into the code, I found all the same steps up to now apply exactly to the VB and C# samples.
The next Core Functionality sample FindAddress has a simpler interface, but actually brings in a map.
I got one crash when switching between locations in the listbox which I could not reproduce, otherwise it's somewhat invigorating to see how little is back there in the BuildMap and RenderMap subroutines.
Continuing on, FindNearby utlizes MapPoint customer's own data showing nearby custom locations and also incorporates navigation and zoom buttons, now we're getting somewhere!
FindNearRoute works and show a pretty map, again with navigation and zoom buttons.
The the MapWithNavigationButtons sample, I had tried shortening the Virtual Directory name to MapWithNavCS, but Visual Studio then refused to open the project. Glancing at "MapWithNavigationButtonsCS.csproj" with TextPad, it looks like there are a couple settings with MapWithNavigationButtonsCS as the property including RootNamespace and AssemblyName, one or the other must require that the Virtual Directory have an identical name.
The Route sample is similar to FindNearRoute without the locations along the route.
Thus far we have looked at all of the core functionality samples, there are several more advanced samples including ClickToCenterMap, DataUploadClient, DragPushpinOnMap, ImageMap, InsetOverviewMap, MobileApplications (PocketIE), PanMapNavigationControl, PointConversion, StoreLocator, and TurnByTurnRouteMaps. I'll save these for future articles.
Web. The next challenge is to actually get these to run on a web server. I did not really have much trouble, after uploading the locally compiled solution to my ISP (which supports ASP.NET) and fiddling around a bit, the samples run: http://mpws35-findcs.frostsolutions.com/Find.aspx.
The biggest hurdle was in finding that subfolders do not work. That is, I could not get the sample to run in "http://www.frostsolutions.com/FindCS/Find.aspx" but it would work in "http://www.frostsolutions.com/Find.aspx". This is not a good work-around as it would require a separate domain for each sample. An acceptable work-around was to create a subdomain for each sample like the first link above. (Note that it may be possible even with my ISP to get it to work in subdomains by changing some settings in web.config or elsewhere in the code).
Below is a complete list of the Core Functionality C# samples:
It's fun and easier than I would have imagined to get the samples up and running and published to the web. I would encourage any MapPoint developer still sitting on the sidelines and take the plunge with an evaluation account and check it out.
Discuss this story in the forum.
Author: Eric Frost
Eric is Editor and Publisher of MP2K Magazine and is a part-time student in University of Chicago's evening MBA program. Eric recently finished the MP2Kmag Guide What's New in MapPoint 2004.