mkoneya

Access IGeoDataServer from a 10.2 SOE

Discussion created by mkoneya on Jun 30, 2014
Latest reply on Aug 8, 2014 by mkoneya
I created a SOAP SOE in ArcGIS Server 10.0 and am trying to convert it to 10.2.   As part of the SOE,  I access a Feature Class from an IGeoDataServer.    I used to be able to connect to the ArcGIS Server using the machine name  and iterate through the ServerObjectNames, but due to local connections not being supported in 10.2 I can no longer do that.  

I changed my code to use an internet connection,  but keep getting a "bad syntax error" when trying to retrieve the ServerObjectNames.  

Our ArcGIS server map services are secured using web authentication and AD roles.    I tried to put in a valid user but it did not work either.

This code works on an ArcGIS console application but not within my SOE.   How can I connect to the IGeoDataServer from an SOE?

Thanks,

Mele


private IGeoDataServer InitGeoDataServerFromNetworkServer(String machineName, String
    serviceName)
        {
            // Create a property set for connection properties.
            IPropertySet propertySet = new PropertySetClass();
            //propertySet.SetProperty("Machine", machineName);

            propertySet.SetProperty("user", @"domain\mapuser");
            propertySet.SetProperty("password", "1234");
            propertySet.SetProperty("CONNECTIONTYPE", "esriConnectionTypeInternet");
            propertySet.SetProperty("URL", "http://server/arcgis/rest/services/");

            
            // Connect to the server and get an enumerator for its objects.
            IAGSServerConnectionFactory agsServerConnectionFactory = new
                AGSServerConnectionFactoryClass();
            IAGSServerConnection agsServerConnection = agsServerConnectionFactory.Open
                (propertySet, 0);
            IAGSEnumServerObjectName enumServerObjectName =
                agsServerConnection.ServerObjectNames;
            enumServerObjectName.Reset();

            // Iterate through the objects to locate the GeoData service.
            IAGSServerObjectName serverObjectName = null;
            IGeoDataServer geoDataServer = null;
            while ((serverObjectName = enumServerObjectName.Next()) != null)
            {
                if (serverObjectName.Name == serviceName)
                {
                    IName name = (IName)serverObjectName;
                    geoDataServer = (IGeoDataServer)name.Open();
                    break;
                }
            }

            return geoDataServer;
        }

Outcomes