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.
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&returnDi..."], "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
Sanoop,
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&returnDi..."], "message": "Proxy has not been set up for this URL."}}
server http://xx.xx.113.xx: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="xxxxxx"
password="xxxxx"
clientId="xxxxxxx"
clientSecret="xxxxxxxx"
rateLimit="600"
rateLimitPeriod="60"
accessToken="xxxxxxxxx"
matchAll="true"
/>
</serverUrls>
</ProxyConfig>
javascript code . :
Sanoop,
Hmm. I am not sure how you are missing the simple image that illistrates what you need in your proxy.config:
Yours should be configured just like this image.
Thanks for your reply, i'll try and let you know our service team is not available so tomorrow sure i'll update you Thanks so much. i'm new in arc GIS
@Robert Scheitlin, GISP Tanks so much it's working
Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.