I try to use my own geocode service on LocateWidget from http://resources.esri.com/arcgisserver/apis/flex/index.cfm?fa=codeGalleryDetails&scriptID=16266 but I got error message. My Geocode server only have one "Street" address fields and I used Token to secure my map services. Everything is working ok without apply token to locatewidgte.mxml file. ------------------------------------------ Here are all the error messages: ------------------------------------------ JSONParseError: Unexpected o encountered at com.esri.serialization.json::JSONTokenizer/parseError() at com.esri.serialization.json::JSONTokenizer/getNextToken() at com.esri.serialization.json::JSONDecoder/nextToken() at com.esri.serialization.json::JSONDecoder/parseArray() at com.esri.serialization.json::JSONDecoder/parseValue() at com.esri.serialization.json::JSONDecoder() at com.esri.serialization.json::JSON$/decode() at com.esri.solutions.flexviewer.widgets::LocateWidget/onJSONLoad() at com.esri.solutions.flexviewer.widgets::LocateWidget/__locatorService_result() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at HTTPOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent() at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler() at mx.rpc::Responder/result() at mx.rpc::AsyncRequest/acknowledge() at DirectHTTPMessageResponder/completeHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete() -------------------------- Locatewidget.mxml -------------------------- <configuration> <locator>http://gis:8399/arcgis/rest/services/test/strLineAddrLoc/GeocodeServer?token=X</locator> <minscore>80</minscore> <zoomscale>5000</zoomscale> <geometryservice>http://orthogonal.esri.com/ArcGIS/rest/services/Geometry/GeometryServer</geometryservice> <inspatial>102698</inspatial> <outspatial>102698</outspatial> </configuration>
The JSON being returned is not well formed. Try capturing the JSON and then validating it using an external validator, and then you'll at least be able to pinpoint what the problem is with the JSON. Here's an online validator you can try: http://www.jsonlint.com/
Some methods to capture the JSON payload include: - setting a breakpoint in your app and using trace("JSON: " + String(event.result)); - using Fiddler