Route Task Error

2243
3
03-26-2013 05:33 AM
BrianHennessey
New Contributor II
I receive
"Unable to complete operation., Unable to find attribute .  Invalid context."

when calling the NA servers' Route. Here is the code that I'm using to call the service

                RouteTask routeTask = new RouteTask("http://{ourInternalServer}/arcgis/rest/services/wm_Closest_Facility/NAServer/Route");
                
                // create the stop collection
                GraphicsLayer startEndPoints = new GraphicsLayer();
                Graphic testG = new Graphic();
                testG.Geometry = new MapPoint(-8639323.8133,4529937.4133, new SpatialReference(WEB_MERC_SPATIAL_REF));
                testG.Symbol =LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

                startEndPoints.Graphics.Add(testG);
                
                Graphic endG = new Graphic()
                {
                    Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol,
                    Geometry = endPoint
                };
                startEndPoints.Graphics.Add(endG);
                RouteParameters routeParameters = new RouteParameters()
                {
                    Stops = startEndPoints,
                    ReturnDirections = true,
                    OutSpatialReference = new SpatialReference(WEB_MERC_SPATIAL_REF),
                };


                routeTask.Failed += (source, args) =>
                {
                    string errorMessage = "";
                    try
                    {
                        errorMessage += args.Error.Message;
                        foreach (string detail in (args.Error as ServiceException).Details)
                        {
                            errorMessage += "," + detail;
                        }
                    }
                    catch (Exception e)
                    {
                        errorMessage += ", no details.";
                    }
                    tbInfo.Text = "Route failed: " + errorMessage;
                    CloseSidebar();
                };


                routeTask.SolveCompleted += (source, args) =>
                {
                    // Get the route and apply a symbol to it
                      --never gets here 


the endPoint is a valid MapPoint that was just plotted on the map. I'm using Runtime 10.1.1 and calling a 10.1 service. Any ideas? Or how to track down this error?
0 Kudos
3 Replies
houdahouda
New Contributor
I have made a model using model builder like described here , then i published the model on arcgis server, before calling it using silverlight, it's working 🙂
0 Kudos
JoshV
by
Occasional Contributor
Brian,

Did you ever have any luck with this?  I have the same problem.  I have multiple routes that work perfectly fine in ArcMap but in using the routing service I created, I'm getting this error on all my routes but one.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

This error is coming directly from the NAServer, therefore it's failing to solve the route because one or more route parameters are invalid. Perhaps you are misspelling an attribute or missing an attribute that might be mandatory?

Take a look at the end point for your service (e.g. http://sampleserver6.arcgisonline.com/arcgis/rest/services/NetworkAnalysis/SanDiego/NAServer/Route) and check everything looks ok.

You could try running Fiddler, catching the request that is being submitted from the API to your server and take a look at that. Then check against the service and the doc: http://resources.arcgis.com/en/help/rest/apiref/index.html?nasolve.html.

Cheers

Mike
0 Kudos