I've written a Silverlight class to consume the Bing Maps Routing Service. I'm creating an array of Waypoint objects from lat/long data that I have stored in a database, and sending that to the CalculateRoute method of the webservice in order to get a route back, but I am unable to successfully get a route back. The response always contains the error "An error occurred while processing the request." I'm stumped. Any ideas about how I could solve this or at least get a more helpful error/exception out of the service? Here's the method that calls the service:
public void CalculateRoute(Waypoint[] waypoints)
{
request = new RouteRequest();
request.Waypoints = new ObservableCollection<Waypoint>();
for (int idx = 0; idx < waypoints.Length; idx++)
{
request.Waypoints.Add(waypoints[idx] as Waypoint);
}
request.ExecutionOptions = new ExecutionOptions();
request.ExecutionOptions.SuppressFaults = true;
request.Options = new RouteOptions();
request.Options.Optimization = RouteOptimization.MinimizeTime;
request.Options.RoutePathType = RoutePathType.Points;
request.Options.Mode = TravelMode.Walking;
request.Options.TrafficUsage = TrafficUsage.TrafficBasedRouteAndTime;
_map.CredentialsProvider.GetCredentials(
(Credentials credentials) =>
{
request.Credentials = credentials;
RouteClient.CalculateRouteAsync(request);
});
}
I then have a callback that handles the response, but I have been unable to get a successful response. I've tried making sure the maxBufferSize and maxReceivedMessageSize are set correctly and that timeouts are set correctly, but to no avail. Any help would be much appreciated.