Problem with World Routing Service.

2411
5
Jump to solution
09-20-2012 06:08 AM
FredHejazi
New Contributor III
I posted this question earlier, where we seem to hit a limit on the number of stops in a routing request.  I was just trying out the following sample from the help

http://help.arcgis.com/en/webapi/javascript/arcgis/demos/routetask/routetask_multiple_stops.html 

After 10 stops, it will not route anymore.  When I copy the sample to my server and try it, the limit is 7.  Which is odd.  Anyway after some digging, it turns out that the regular routing engine is limited to 10 stops.  I needed to get the world routing service which has a higher limit on the stops.  I think 25.  Anyway, its a paid service, which we purchased and followed the steps for getting a token. 

Then to test it out, in the same example above,  replaced the line

       routeTask = new esri.tasks.RouteTask("http://tasks.arcgisonline.com/ArcGIS/rest/services/NetworkAnalysis/ESRI_Route_NA/NAServer/Route");

With the following line, which is supposedly what we are to use.

         routeTask = new esri.tasks.RouteTask("http://premiumtasks.arcgisonline.com/server/rest/services/NetworkAnalysis/ESRI_Route_NA/NAServer/Lon..............");

Only a part of the token is listed above.  However, we seem to have the same 7 stop limit.  When we don't include the token, we get an access denied error.  If the token is incorrect, we get an invalid token error. 

So, its appears that it is accepting the token when it is correct, just not performing anymore than 7 stops. 

Anyone else here knows anything about the world routing engine and how to get it to work?

Thanks
0 Kudos
1 Solution

Accepted Solutions
FredHejazi
New Contributor III
I did call tech support and they figured it out.  Since it was a tricky I am posting the answer here.  The problem was the samples use an ESRI proxy.  You need a proxy because the request can get bigger than 2048 characters.  The following is the line.

esri.config.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx";

Which is why it stopped working at 7 stops.  The request was just bigger than 2048 and was getting cut off.  Since there were no error messages, it was tough to diagnose. 

There is information on how to setup a proxy page on this link

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp_start.htm

However, if you install the php version, you will need cURL.  The instructions that come up if cURL is not installed are for windows.  They will not work for Linux and Apache.  Use the instructions from the following link

http://askubuntu.com/questions/9293/how-do-i-install-curl-in-php5

View solution in original post

0 Kudos
5 Replies
derekswingley1
Frequent Contributor
What is the error when you specify more than seven stops?

Honestly, you'll probably be able to get a faster answer by contacting tech support. Can you open a ticket with them?
0 Kudos
FredHejazi
New Contributor III
I was going to try this avenue first.  If not, I will try tech support next.  There is no error message at all.  That is the part that is puzzling.  It just seems to ignore the request once we hit 7.
0 Kudos
derekswingley1
Frequent Contributor
Can you post a simple test page that shows the problem?
0 Kudos
FredHejazi
New Contributor III
I did call tech support and they figured it out.  Since it was a tricky I am posting the answer here.  The problem was the samples use an ESRI proxy.  You need a proxy because the request can get bigger than 2048 characters.  The following is the line.

esri.config.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx";

Which is why it stopped working at 7 stops.  The request was just bigger than 2048 and was getting cut off.  Since there were no error messages, it was tough to diagnose. 

There is information on how to setup a proxy page on this link

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp_start.htm

However, if you install the php version, you will need cURL.  The instructions that come up if cURL is not installed are for windows.  They will not work for Linux and Apache.  Use the instructions from the following link

http://askubuntu.com/questions/9293/how-do-i-install-curl-in-php5
0 Kudos
derekswingley1
Frequent Contributor
Glad you got it figured out. I'm surprised you didn't see any errors. Usually, when requests are failing due to the URL being too large, you see this message in the browser's console:
esri.config.defaults.io.proxyUrl is not set.


Along with several errors. Take a look at this sample on jsfiddle that tries to buffer a large polygon:  http://jsfiddle.net/xnWQC/
0 Kudos