Issue on ArcGIS SOAP NAServer Namespace

342
0
09-08-2017 12:40 PM
BehrouzHosseini
Occasional Contributor

I am trying to create a simple ArcGIS Server SOAP consumer by C# like below snippet but I am getting error on NAService_NAServeras illustrated in attached image. Can you please let me know which namespace I have to use?

enter image description here

I am already using this namespaces

using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Server;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;‍‍‍‍‍

but they are not doing the job!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Server;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            private void SolveRoute()
        {
            // Connect to server
            NAService_NAServer naService = new NAService_NAServer();
            naService.Url = "http://localhost/ArcGIS/services/NetworkAnalysisService/MapServer/NAServer");
            //Get Route layers
            string[] routeLayers = naService.GetNALayerNames(esriNAServerLayerType.esriNAServerRouteLayer);

            // Get the default settings for the first route layer
            NAServerRouteParams naServerRouteParams = (NAServerRouteParams)naService.GetSolverParameters(routeLayers[0]);

            // Create 2 stops as property sets
            List<PropertySet> propertySets = new List<PropertySet>(2);
            propertySets.Add(CreatePropertySet("My starting point", -117.195905, 34.057783));
            propertySets.Add(CreatePropertySet("My ending point", -117.180943, 34.056286));

            // Set the property sets on a NAServerPropertySets object and set on the routeParams object
            NAServerPropertySets naServerPropertySets = new NAServerPropertySets();
            naServerPropertySets.PropertySets = propertySets.ToArray();
            naServerRouteParams.Stops = naServerPropertySets;

            // specify to return compact directions
            naServerRouteParams.ReturnCompactDirections = true;

            // Solve
            NAServerRouteResults naServerRouteResults = (NAServerRouteResults)naServer.Solve(naServerRouteParams);

            // Output directions
            NACompactStreetDirections streetDirections = naServerRouteResults.CompactDirections[0];
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("DriveTime = {0}", streetDirections.Summary.TotalDriveTime);
            sb.AppendLine();
            foreach (NACompactStreetDirection streetDirection in streetDirections.Directions)
            {
                sb.AppendLine(streetDirection.Text);
            }
            Console.WriteLine(sb.ToString());
        }

    }
    }
}
0 Kudos
0 Replies