We are using latest version of MongoDB which has geospatial capabilities and a Ruby on Rails application that would like to use geonames web service to return all postcodes within a polygon drawn by the user.
You can calculate the smalles circle around your polyon and query with the center coordinates and the radius of the circle. You can then filter the result with the polyon. The geonames web service do not yet accept polygon input parameters.