AnsweredAssumed Answered

How to access ArcSDE geodatabase as IWorkspace from GeoData Service using ArcObjects JAVA?

Question asked by majetivaraprasad on Jan 4, 2017

Hi,

 

Could someone please tell me how to access ArcSDE Geodatabase, which is published as GeoData service, into IWorkspace interface using ArcObjects.

 

I am trying to initialize IGeoDataServer as below and then trying to cast this object to instantiate IGeoDataServerObjects interface and then call IGeoDataServerObjects::getDefaultWorkingWorkspace() to get object of IWorkspace.

 

static IGeoDataServer initGeoDataServerFromInternetServer(String url, String
    serviceName)throws Exception{
    // Create a property set for connection properties.
    IPropertySet propertySet = new PropertySet();
    propertySet.setProperty("URL", url);
    // Connect to the server and get an enumerator for its objects.
    IAGSServerConnectionFactory agsServerConnectionFactory = new
        AGSServerConnectionFactory();
    IAGSServerConnection agsServerConnection = agsServerConnectionFactory.open
        (propertySet, 0);
    IAGSEnumServerObjectName enumServerObjectName =
        agsServerConnection.getServerObjectNames();
    enumServerObjectName.reset();
    // Iterate through the objects to locate the geodata service.
    IAGSServerObjectName serverObjectName = null;
    IGeoDataServer geoDataServer = null;
    while ((serverObjectName = enumServerObjectName.next()) != null){
        if (serverObjectName.getName().equals(serviceName)){
            IName name = (IName)serverObjectName;
            geoDataServer = (IGeoDataServer)name.open();
            break;
        }
    }
    return geoDataServer;
}

However, unable to cast object of IGeoDataServer neither to GeoDataServer nor IGeoDataServerObjects interface.

 

Please let me know if I am not clear anywhere.

 

Thanks &Regards,

Vara Prasad.

Outcomes