Created
February 25, 2013 14:28
-
-
Save maplinkapi/5030148 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final String TOKEN = "SEU_TOKEN"; | |
City city = new City(); | |
city.setName("São Paulo"); | |
city.setState("SP"); | |
ResultRange resultRange = new ResultRange(); | |
resultRange.setPageIndex(1); | |
resultRange.setRecordsPerPage(10); | |
AddressOptions addressOptions = new AddressOptions(); | |
addressOptions.setUsePhonetic(true); | |
addressOptions.setSearchType(2); | |
addressOptions.setResultRange(resultRange); | |
AddressFinderLocator addressFinderLocator = new AddressFinderLocator(); | |
CityLocationInfo findCityResponse = addressFinderLocator.getAddressFinderSoap().findCity(city, addressOptions, TOKEN); | |
CityLocation[] cityLocations = findCityResponse.getCityLocation(); | |
StringBuilder findCityResult = new StringBuilder(); | |
findCityResult.append("Page Count: ").append(findCityResponse.getPageCount()); | |
findCityResult.append("Record Count: ").append(findCityResponse.getRecordCount()); | |
final String NEW_LINE = "\n"; | |
for (CityLocation cityLocation : cityLocations) { | |
findCityResult.append(NEW_LINE); | |
findCityResult.append("Cidade: ").append(cityLocation.getCity().getName()); | |
findCityResult.append(", Estado: ").append(cityLocation.getCity().getState()); | |
findCityResult.append(", Latitude: ").append(cityLocation.getPoint().getY()); | |
findCityResult.append(", Longitude: ").append(cityLocation.getPoint().getX()); | |
findCityResult.append(", Acesso de automóveis: ").append(cityLocation.isCarAccess()); | |
findCityResult.append(", Intervalo de início de códigos postais: ").append(cityLocation.getZipRangeStart()); | |
findCityResult.append(", Intervalo de término de códigos postais: ").append(cityLocation.getZipRangeEnd()); | |
findCityResult.append(", DataSource: ").append(cityLocation.isCapital()); | |
} | |
System.out.println(findCityResult.toString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment