static void Main(string[] args) { SearchLocationsRequest request = CreateSearchLocationsRequest(); // LocationsService service = new LocationsService(); if (usePropertyFile()) { service.Url = getProperty("endpoint"); } // try { // Call the Locations web service passing in a SearchLocationsRequest and returning a SearchLocationsReply SearchLocationsReply reply = service.searchLocations(request); if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING) { ShowSearchLocationsReply(reply); } ShowNotifications(reply); } catch (SoapException e) { Console.WriteLine(e.Detail.InnerText); } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine("Press any key to quit!"); Console.ReadKey(); }
private static void ShowNotifications(SearchLocationsReply reply) { Console.WriteLine("Notifications"); for (int i = 0; i < reply.Notifications.Length; i++) { Notification notification = reply.Notifications[i]; Console.WriteLine("Notification no. {0}", i); Console.WriteLine(" Severity: {0}", notification.Severity); Console.WriteLine(" Code: {0}", notification.Code); Console.WriteLine(" Message: {0}", notification.Message); Console.WriteLine(" Source: {0}", notification.Source); } }
private static void ShowSearchLocationsReply(SearchLocationsReply reply) { Console.WriteLine("Total Locations Available: {0}", reply.TotalResultsAvailable); Console.WriteLine("Locations Returned: {0}", reply.ResultsReturned); Console.WriteLine(); if (reply.AddressToLocationRelationships != null) { foreach (AddressToLocationRelationshipDetail location in reply.AddressToLocationRelationships) { if (location.MatchedAddress != null) { Console.WriteLine("Address information used for search"); if (location.MatchedAddress.StreetLines != null) { foreach (String streetline in location.MatchedAddress.StreetLines) { Console.WriteLine(" Streetline: {0}", streetline); } } if (location.MatchedAddress.City != null) { Console.WriteLine(" City: {0}", location.MatchedAddress.City); } if (location.MatchedAddress.StateOrProvinceCode != null) { Console.WriteLine(" State or Province Code: {0}", location.MatchedAddress.StateOrProvinceCode); } if (location.MatchedAddress.PostalCode != null) { Console.WriteLine(" Postal Code: {0}", location.MatchedAddress.PostalCode); } if (location.MatchedAddress.CountryCode != null) { Console.WriteLine(" Country Code: {0}", location.MatchedAddress.CountryCode); } } Console.WriteLine(); ShowLocation(location); } } }