submit login information
search button
NAVTEQ Logo_Click to go back to homepage     Store Map Reporter Developers Merchants     About Us
Buy a
Map
Update
Report Map
Changes
NAVTEQ
Network for
Developers
Put your Brand
on our Map
 
 
  • Most Read
  • Top Searches
  • Top Rated
  • My Profile

      If you're a member, please login to see this information.

      If you're not a member, then become one now

  • My Favorites

      If you're a member, please login to see this information.

      If you're not a member, then become one now

  • Recently Viewed

      If you're a member, please login to see this information.

      If you're not a member, then become one now

  • Share & Save
blogspot facebook twitter linkedin youtube flickr

Score:
Login to rate page

Map24 Web Services for Visual C# .NET Client Applications

Download client stubs and wrapper classes: map24wsclientscsharp.zip (89 KB)

Follow the instructions below for an easy start with Map24 Web Services. One way to create Web service client applications is by using client stubs that are generated from WSDLs. This is not the only way but it is common and fairly straight forward. Stubs can be generated with the wsdl tool that is provided with Visual Studio. You can download client stubs of the most recent WSDLs for some of the Map24 Web Services as zip file (see link above). The zip file also contains project files for Visual Studio that contain demo clients for the Map24 Geocoder Service, Map24 Maplet Remote Control Service, Map24 Routing Service, Map24 ReverseGeocoder Service, and Map24 MGI Service. Follow the steps in the Getting Started section below to run a demo client.

 

Getting Started

Prerequisites: Microsoft Visual Studio C# 2005 (Express Edition is OK, too)

Follow the steps described here to run the demo client for the Map24 Geocoder Service that is contained in the map24wsclientscsharp.zip file. This demo application sends a geocoding request to the Map24 Web Services and prints out the geocoded addresses:

  1. Download the client stubs and demo projects: map24wsclientscsharp.zip
  2. Unzip the file.
  3. Open the demo project. The demo project is contained in the Map24Geocoder51 directory.
  4. Edit the client stub for the Map24 Geocoder 5.1 Service ('Map24Geocoder51.cs').
    • In the Map24Geocoder51 constructor replace the MapTP server URL parameter with the URL that you received with your Map24 ID.
  5. Edit the demo application ('Map24Geocoder51Client.cs') shown in the code listing below.
    • Specify your Map24 ID in the RequestHeader.Map24ID parameter.
    • Specify the search text in SearchRequest.SearchText. The default search text might not fit to your map region.
  6. Build and run the client. The result is printed to the console.
Demo application:
namespace Com.Mapsolute.Webservices.Map24Geocoder51  {

using System;
using System.IO;

public class Map24Geocoder51Client
{
public static void Map24Geocoder51()
{
bool permit = true;

try
{
RequestHeader RequestHeader = new RequestHeader();
RequestHeader.Map24ID = "Your Map24ID goes here";
Map24Geocoder51 Map24Geocoder51 = new Map24Geocoder51();

if (permit) // freeSearchRequest
{
Console.WriteLine("Map24Geocoder51() SearchFreeRequest");
// create request
MapSearchFreeRequest SearchRequest = new MapSearchFreeRequest();
SearchRequest.SearchText = "Crissy Field San Francisco";
SearchRequest.MaxNoOfAlternatives = 3;

// make request to server
MapSearchResponse Response = Map24Geocoder51.searchFree(
RequestHeader, SearchRequest);

// show response on console
Console.WriteLine("Alternatives " + Response.Alternatives.GetLength(0));
int iAlt = Response.Alternatives.GetLength(0);

// loop through all alternatives
for (int j = 0; j < iAlt; j++)
{
Console.WriteLine("Alternative : " + j);
Console.WriteLine("Longitude : " + Response.Alternatives[j].Coordinate.Longitude);
Console.WriteLine("Latitude : " + Response.Alternatives[j].Coordinate.Latitude);
int iMax = Response.Alternatives[j].PropertiesMajor.GetLength(0);

// loop through address properties
for (int i = 0; i < iMax; i++)
{
Console.WriteLine(
Response.Alternatives[j].PropertiesMajor[i].Key + " : " +
Response.Alternatives[j].PropertiesMajor[i].Value);
}
}
}
catch(Exception e)
{
Console.Error.WriteLine(e);
}
}

public static int Main(){
Map24Geocoder51();
return 0;
}
}
}

Generating Client Stubs

You can generate the client stubs yourself. This is necessary if you want to use one of the previous versions of the Map24 Web Services' WSDL.

 

Notes for Creating new Projects in Visual Studio

The Visual Studio projects that come in the provided zip file are all configured with the two things described below.

Reference System.Web.Service

If you create a new project with Visual Studio don't forget to add the references 'System.Web' and 'System.Web.Services'.

Work around HTTP 400 Bad Request Errors

If you are getting an HTTP 400 bad request error when debugging in Visual Studio add an app.config file with the switch Remote.Disable with value = 1 to your project. Here is why and how to do it:

To be able to send requests to the Map24 Web Services you have to add a file called "app.config" to your Visual C# .NET or Visual Basic .NET project. Then you can work in your project using all debugging resources (breakpoints, watches, etc.). This file must contain the following:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration>
<system.diagnostics>
<switches>
<add name="Remote.Disable" value="1"/>
</switches>
</system.diagnostics>
</configuration>

If you do not include this file you might see a "HTTP status 400: bad request" error when sending requests to the Map24 Web Services. This is a known problem in Microsoft Visual Studio. The .NET debugger attaches so-called "debug causality data" to each outgoing request. This data is used for debugging. However, this data destroys the well-formedness of the request and as a consequence the MapTP server returns an error.