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 VB.NET Client Applications

Download client stubs and wrapper classes: map24wsclientsvb.zip (1,2 MB)

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 VB 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 map24wsclientsvb.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: map24wsclientsvb.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.vb').
    • In the Map24Geocoder51 constructor method New() replace the MapTP server URL with the URL that you received with your Map24 ID.
  5. Edit the demo application ('Map24Geocoder51Client.vb') shown in the code listing below.
    • Specify your Map24 ID in the MAP24ID field.
    • 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:

Option Strict Off
Option Explicit On

Imports System

Namespace Com.Mapsolute.Webservices.Map24Geocoder51

Public Class Geocoder51Client

Inherits Map24Geocoder51

' The searchFree request allows single field input where the parts of the text string can be
' in any order. This example request returns the coordinates of the Tower Bridge in London.
Public Function SearchFree()

Try

Dim RequestHeader As New RequestHeader
RequestHeader.Map24ID = "Your Map24 ID goes here"
Dim Map24Geocoder51 As New Map24Geocoder51

' freeSearchRequest

Console.WriteLine("Map24Geocoder51() SearchFreeRequest")
' create request
Dim SearchRequest As New MapSearchFreeRequest()
' specify the search text. Note: The default search text might not fit to your map region.
SearchRequest.SearchText = "London Tower Bridge"
' maximum number of returned geocoding results for the given address
SearchRequest.MaxNoOfAlternatives = 3

' send request to server
Dim Response As New MapSearchResponse

Response = Map24Geocoder51.searchFree(RequestHeader, SearchRequest)

' show response on console
Console.WriteLine("Alternatives " + Response.Alternatives.Length.ToString)


Dim i, j As Int16
' loop through all geocoding results
For i = 0 To (Response.Alternatives.Length - 1) Step 1

Console.WriteLine("Alternative : " + i.ToString)
' loop through address properties
For j = 0 To (Response.Alternatives(i).PropertiesMajor.Length - 1) Step 1

Console.WriteLine(Response.Alternatives(i).PropertiesMajor(j).Key + " : " + Response.Alternatives(i).PropertiesMajor(j).Value)



Next


Next
Console.WriteLine("--------------------------------------------------")

Catch e As Exception

Console.WriteLine(e)

End Try

End Function

Public Shared Function Main(ByVal args() As String) As Integer

Dim Client As New Geocoder51Client

Client.SearchFree()

Return 0

End Function

End Class

End Namespace

 

Generating Client Stubs

You can generate 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.