You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.
class GeoCoderService {
def getLatLong(String address) {
def result = null
withHttp(uri: "http://maps.googleapis.com") {
def html = get(path : '/maps/api/geocode/json', query : [address:address])
if ( html.results != null && html.results.size() > 0 ) {
def partial = html.results[0]
if ( partial.geometry != null && partial.geometry.location != null) {
def lat = partial.geometry.location.lat
def lng = partial.geometry.location.lng
result = [lat:Double.valueOf(lat.toString()), lng:Double.valueOf(lng.toString())]
}
}
}
return result
}
}
Controller class:
class GeneralController {
def geoCoderService
def index = {
render (view: "index")
}
def test = {
def point = geoCoderService.getLatLong('1600 Amphitheatre Pkwy, Mountain View, CA 94043')
render "latitude = ${point.lat}"
render "longitude = ${point.lng}"
}
}
Exception:
Caused by: groovy.lang.MissingMethodException: No signature of method: package.GeoCoderService.withHttp() is applicable for argument types: (java.util.LinkedHashMap, package.GeoCoderService$_getLatLong_closure1) values: [[uri:http://maps.googleapis.com], package.GeoCoderService$_getLatLong_closure1@5ad666a2]
at package.GeoCoderService.getLatLong(GeoCoderService.groovy:6) ~[main/:na]
at package.GeneralController$_closure2.doCall(GeneralController.groovy:12) ~[main/:na]
... 3 common frames omitted
The text was updated successfully, but these errors were encountered:
ghost
changed the title
groovy.lang.MissingMethodException when calling withHttp from a service
groovy.lang.MissingMethodException when calling withHttp() from a service
Sep 11, 2015
Service class:
Controller class:
Exception:
The text was updated successfully, but these errors were encountered: