Share via


MapPoint Web Service SOAP Headers

MapPoint Web Service SOAP Headers

The MapPoint Web Service has four classes for use in SOAP headers: one each for the common, find, render, and route services. Each of these classes contains two headers: one for customer-defined transaction logging, and one for setting the context-related information that defines the locale, language, and unit of measurement in which results are returned from the methods called from the service. The header classes for the find, render, and route services inherit the properties set in the related headers for the common service.

The following table shows each MapPoint Web Service service and its related service class, in addition to the methods and headers that each service class contains.

Service

Service class

Methods

Headers

Common

CommonServiceSoap

GetCountryRegionInfo

GetDataSourceInfo

GetEntityTypes

GetGreatCircleDistances

GetVersionInfo

CustomerInfoHeaderValue (CustomerInfoHeader class, which contains the CustomLogEntry property)

UserInfoHeaderValue (UserInfoHeader class, which contains the Context, Culture, and DefaultDistanceUnit properties)

Find

FindServiceSoap

Find

FindAddress

FindByID

FindByProperty

FindNearby

FindPolygon

FindNearRoute

GetLocationInfo

ParseAddress

CustomerInfoFindHeaderValue (CustomerInfoFindHeader class, which contains the CustomLogEntry property)

UserInfoFindHeaderValue (UserInfoFindHeader class, which contains the Context, Culture, and DefaultDistanceUnit properties)

Render

RenderServiceSoap

ConvertToLatLong

ConvertToPoint

GetBestMapView

GetLineDriveMap

GetMap

CustomerInfoRenderHeaderValue (CustomerInfoRenderHeader class, which contains the CustomLogEntry property)

UserInfoRenderHeaderValue (UserInfoRenderHeader class, which contains the Context, Culture, and DefaultDistanceUnit properties)

Route

RouteServiceSoap

CalculateRoute

CalculateSimpleRoute

CustomerInfoRouteHeaderValue (CustomerInfoRouteHeader class, which contains the CustomLogEntry property)

UserInfoRouteHeaderValue (UserInfoRouteHeader class, which contains the Context, Culture, and DefaultDistanceUnit properties)

Example

        
[Visual Basic]
 
'Declare the service variables and set credentials
Dim findService As New FindServiceSoap()
Dim routeService As New RouteServiceSoap()

findService.Credentials = New System.Net.NetworkCredential("UserID", "Password")
routeService.Credentials = New System.Net.NetworkCredential("UserID", "Password")

'Declare header variables
Dim myUserInfoFindHeader As New UserInfoFindHeader()
Dim myUserInfoRouteHeader As New UserInfoRouteHeader()
Dim myCultureInfo As New CultureInfo()

'Set the language to Spanish before making the Find call
myCultureInfo.Name = "es"
myUserInfoFindHeader.Culture = myCultureInfo
findService.UserInfoFindHeaderValue = myUserInfoFindHeader

'Find two locations
Dim foundResults1 As FindResults
Dim foundResults2 As FindResults

Dim findSpec As New FindSpecification()
findSpec.DataSourceName = "MapPoint.NA"
findSpec.InputPlace = "Seattle"

foundResults1 = findService.Find(findSpec)

findSpec.InputPlace = "Redmond"
foundResults2 = findService.Find(findSpec)

'Use the result of the Find calls in a Route call
Dim myRoute As Route

Dim myLatLongs(1) As LatLong
myLatLongs(0) = foundResults1.Results(0).FoundLocation.LatLong
myLatLongs(1) = foundResults2.Results(0).FoundLocation.LatLong

'Make a call to the Route service, using Miles as the distance unit and Spanish as the language
myUserInfoRouteHeader.Culture = myCultureInfo
myUserInfoRouteHeader.DefaultDistanceUnit = DistanceUnit.Mile
routeService.UserInfoRouteHeaderValue = myUserInfoRouteHeader

myRoute = routeService.CalculateSimpleRoute(myLatLongs, "MapPoint.NA", SegmentPreference.Quickest)

'Output the route distance, which is returned in miles, and the directions, which are returned in Spanish
Console.WriteLine("Total route distance in miles: " + myRoute.Itinerary.Segments(0).Distance.ToString())
Dim direction As Direction
For Each direction In myRoute.Itinerary.Segments(0).Directions
    Console.WriteLine(direction.Instruction)
Next

 


        
[C#]

//Declare the service variables and set credentials
FindServiceSoap findService  = new FindServiceSoap();
RouteServiceSoap routeService  = new RouteServiceSoap();

findService.Credentials = new System.Net.NetworkCredential("UserID", "Password");
routeService.Credentials = new System.Net.NetworkCredential("UserID", "Password");

//Declare header variables
UserInfoFindHeader myUserInfoFindHeader  = new UserInfoFindHeader();
UserInfoRouteHeader myUserInfoRouteHeader  = new UserInfoRouteHeader();
CultureInfo myCultureInfo  = new CultureInfo();

//Set the language to Spanish before making the Find call
myCultureInfo.Name = "es";
myUserInfoFindHeader.Culture = myCultureInfo;
findService.UserInfoFindHeaderValue = myUserInfoFindHeader;

//Find two locations
FindResults foundResults1;
FindResults foundResults2;

FindSpecification findSpec  = new FindSpecification();
findSpec.DataSourceName = "MapPoint.NA";
findSpec.InputPlace = "Seattle";

foundResults1 = findService.Find(findSpec);

findSpec.InputPlace = "Redmond";
foundResults2 = findService.Find(findSpec);

//Use the result of the Find calls in a Route call
Route myRoute;

LatLong[] myLatLongs = new LatLong[2];
myLatLongs[0] = foundResults1.Results[0].FoundLocation.LatLong;
myLatLongs[1] = foundResults2.Results[0].FoundLocation.LatLong;

//Make a call to the Route service, using Miles as the distance unit and Spanish as the language
myUserInfoRouteHeader.Culture = myCultureInfo;
myUserInfoRouteHeader.DefaultDistanceUnit = DistanceUnit.Mile;
routeService.UserInfoRouteHeaderValue = myUserInfoRouteHeader;

myRoute = routeService.CalculateSimpleRoute(myLatLongs, "MapPoint.NA", SegmentPreference.Quickest);

//Output the route distance, which is returned in miles, and the directions, which are returned in Spanish.
Console.WriteLine("Total route distance in miles: " + myRoute.Itinerary.Segments[0].Distance.ToString());
foreach(Direction direction in myRoute.Itinerary.Segments[0].Directions)
{
    Console.WriteLine(direction.Instruction);
}