Hello,
I found out today about this service, impresive tool, and I tried to add it to a java aplication, by using the api provided, but I get all the time the same 403 error:
java.io.IOException: Server returned HTTP response code: 403 for URL: http://api.geonames.org/search?q=malaga&username=jrgu
For me it is weird, because when I input the url in the browser it works correctly, is this normal?
I wrote the code given in the exmaple:
Code:
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
List<Toponym> toponymsList = new ArrayList<Toponym>();
try {
setProxy();
WebService.setUserName("jrgu"); // add your username here
ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria();
searchCriteria.setQ("malaga");
ToponymSearchResult searchResult = WebService
.search(searchCriteria);
toponymsList = searchResult.getToponyms();
} catch (Exception e) {
e.printStackTrace();
}
}
Thanks,
Joaquín