0

I have a map service with an SOE. The SOE works fine and I can call it through http no problem. I would like to call it from an ArcObjects tool but My code errors when trying to cast the MapServer object to the ServerObjectExtensionManager. I think this is because I get a reference to the map service using http, not a LAN connection. Is there a better way of doing this? I can't use a LAN connection but I have to believe there is still a way to get an SOE.

public IServerObjectExtension InitGeoDataServerFromInternetServer(String url, String serviceName)
    {
        IServerObjectExtension pSOE = null;
        // Create a property set for connection properties.
        IPropertySet propertySet = new PropertySetClass();
        propertySet.SetProperty("URL", url);
        propertySet.SetProperty("user", "user");
        propertySet.SetProperty("password", "pass");
        // Connect to the server and get an enumerator for its objects.
        IAGSServerConnectionFactory2 agsServerConnectionFactory = new AGSServerConnectionFactoryClass();

        try
        {
            IAGSServerConnection agsServerConnection = agsServerConnectionFactory.Open(propertySet, 0);
            IAGSEnumServerObjectName enumServerObjectName = agsServerConnection.ServerObjectNames;
            enumServerObjectName.Reset();

            // Iterate through the objects to locate the map service.
            IAGSServerObjectName serverObjectName = null;

            while ((serverObjectName = enumServerObjectName.Next()) != null)
            {
                if (serverObjectName.Name == "Assessor/Assessor" )
                {
                    IName name = (IName)serverObjectName;
                    //ESRI.ArcGIS.Server.IServerObject pSO = (ESRI.ArcGIS.Server.IServerObject)name.Open();

                    IMapServer pO = (IMapServer)name.Open();

                    ESRI.ArcGIS.Server.IServerObjectExtensionManager pSOEM = (ESRI.ArcGIS.Server.IServerObjectExtensionManager)pO;
                    pSOE = pSOEM.FindExtensionByTypeName("CreateVersionSOE");

                }

            }
        }
        catch (System.Runtime.InteropServices.COMException sex)
        {
            System.Diagnostics.Debug.WriteLine(sex.Message);
        }
        catch (Exception sex)
        {
            System.Diagnostics.Debug.WriteLine(sex.Message);
            //throw;
        }

        return pSOE;
    }
  • 1
    SOEs are accessed through HTTP(S) calls. They are just REST endpoints like any other REST endpoint. – Vince Jul 20 '17 at 20:28
  • Right and I can access the SOE through an explicit https get. But I would like to handle it though ArcObjects since I already have a reference to the map server object the contains the SOE. – Dowlers Jul 20 '17 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.