Reverse Geocode Tool Returns Error When no Address is Found
The reverse geocode tool returns a 400 error in the workflow when it doesn't find a result in an ArcGIS geocoding service. The status code of the response is 200 success but the body is a 400 error and the workflow throws and error.
If I send the exact same request using a the "Web Request" tool then it works correctly.
Why does the reverse geocode tool break when the Web Request tool works?
-
Hi Matthew,
The ArcGIS REST API typically returns errors as HTTP 200 responses with the response body being a JSON error object. The ArcGIS JavaScript API (which makes the request for the Reverse Geocode activity) inspects all JSON responses for error objects and it throws the error if it sees one.
The Send Web Request activity uses the browser's XHR facility to make the request. It doesn't bother to interpret the content of the response so it will succeed if it is a HTTP 200 response.
You should be able to use a Try Catch activity to capture this in your workflow. That isn't ideal, but it will work.
--Ryan
0 -
Thanks for the response Ryan.
I did put it into a try catch then check the exception to make sure it's a 400 "Unable to find address for the specified loation" error. If it isn't I throw an exception again. Everything is working well :)
Even if that^ isn't ideal I'd say it's hard for anyone to decide what to do with the response sent back from the ArcGIS server. For example, The message "Cannot perform query. Invalid query parameters" doesn't make sense since ArcGIS did perform the query and came up with no results.
0 -
We should have an update to improve the behaviour for this in version 5.11. The associated bug # to look for in the release notes will be 26158.
0
Please sign in to leave a comment.
Comments
3 comments