I am using the following url to generate route task . https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Route
This is the sample URL, I have tried this URL also https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World
I am getting the same error with both URL. The code that I am following is same as the one mentioned in the sample codes.
https://developers.arcgis.com/javascript/3/jssamples/routetask_find_route.html
Please let me know what am I doing wrong.
Sanoop,
The JS Sample code works using the world route service due to the fact that it is providing credential using the proxy service that is referenced in the code. When you move this code to your machine you are likely not setting up a proxy and/or providing proper AGOL credentials for consuming the route service thus your problem.
You need to spend some time reading about how to setup and configure the esri proxy for consuming the esri world route service:
GitHub - Esri/resource-proxy: Proxy files for DotNet, Java and PHP.
Setting up a Proxy | Support Services Blog
Hello,
Thanks for the quick reply. I have followed the instructions to setup a proxy using resource-proxy. I followed the instructions given in the Readme.md file and got successful response back.
But when I add the proxy URL to the sample project then i get following response.
{"error": {"code": 403,"details": ["Proxy has not been set up for this URL. Make sure there is a serverUrl in the configuration file that matches: https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve?f=json&returnDirections=false&returnRoutes=true&returnZ=true&returnStops=false&returnBarriers=false&returnPolygonBarriers=false&returnPolylineBarriers=false&outSR=102100&outputLines=esriNAOutputLineTrueShape&travelMode=null&stops=%7B%22type%22%3A%22features%22%2C%22features%22%3A%5B%7B%22geometry%22%3A%7B%22x%22%3A8112572.841533409%2C%22y%22%3A2167814.317851392%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D%7D%2C%7B%22geometry%22%3A%7B%22x%22%3A8113814.943243042%2C%22y%22%3A2167126.384596826%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D%7D%5D%2C%22doNotLocateOnRestrictedElements%22%3Atrue%7D&callback=dojo.io.script.jsonp_dojoIoScript1._jsonpCallback"], "message": "Proxy has not been set up for this URL."}}
In the proxy.config file there is a serverUrl section:
<serverUrl url="http://services.arcgisonline.com" matchAll="true"/>
I am guessing we need to change the server url.
This is my new service url
<serverUrl url="http://route.arcgis.com" clientId="flVGYIC8QSZMWiAN" clientSecret="e7f8528d6bce4dd38c0af88355ca7ee1" rateLimit="600" rateLimitPeriod="60" matchAll="false"> </serverUrl>
Please guide me if I am doing anything wrong.
Thank You
The Setting up a Proxy link I provided above is pretty clear on what you need to add to the proxy.config for enabling the route Step 11 and 12 (no need for me to re-write it).
Hello Robert,
i am using ionic 3 mobile platform and i'm getting same error when click ERROR message
{"error": {"code": 403,"details": ["Proxy has not been set up for this URL. Make sure there is a serverUrl in the configuration file that matches: https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve?f=json&returnDirections=false&returnRoutes=true&returnZ=true&returnStops=false&returnBarriers=false&returnPolygonBarriers=false&returnPolylineBarriers=false&outSR=3857&outputLines=esriNAOutputLineTrueShape&stops=%7B%22type%22%3A%22features%22%2C%22features%22%3A%5B%7B%22geometry%22%3A%7B%22spatialReference%22%3A%7B%22latestWkid%22%3A3857%2C%22wkid%22%3A102100%7D%2C%22x%22%3A8125891.5041974485%2C%22y%22%3A2163042.270023918%7D%2C%22attributes%22%3A%7B%7D%7D%2C%7B%22geometry%22%3A%7B%22spatialReference%22%3A%7B%22latestWkid%22%3A3857%2C%22wkid%22%3A102100%7D%2C%22x%22%3A8126497.812559034%2C%22y%22%3A2162430.1766333366%7D%2C%22attributes%22%3A%7B%7D%7D%2C%7B%22geometry%22%3A%7B%22spatialReference%22%3A%7B%22latestWkid%22%3A3857%2C%22wkid%22%3A102100%7D%2C%22x%22%3A8126476.023267714%2C%22y%22%3A2162869.0452701817%7D%2C%22attributes%22%3A%7B%7D%7D%5D%2C%22doNotLocateOnRestrictedElements%22%3Atrue%7D"], "message": "Proxy has not been set up for this URL."}}
server http://xyz.xyz.113.xyz:6880
server config
<?xml version="1.0" encoding="utf-8" ?><ProxyConfig allowedReferers="*" logFile="proxy_log.log" logLevel="INFO" mustMatch="true"> <serverUrls> <serverUrl url="http://services.arcgisonline.com" matchAll="true"/><serverUrls> <serverUrl url="https://route.arcgis.com/arcgis/rest/info?f=json" username="xyz" password="xyz" clientId="xyz" clientSecret="xyz" rateLimit="600" rateLimitPeriod="60" accessToken="xyz" matchAll="true" /></serverUrls></ProxyConfig>
javascript code . :
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.