AnsweredAssumed Answered

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

Question asked by majetivaraprasad on Jan 4, 2017



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
    IAGSServerConnection agsServerConnection =
        (propertySet, 0);
    IAGSEnumServerObjectName enumServerObjectName =
    // Iterate through the objects to locate the geodata service.
    IAGSServerObjectName serverObjectName = null;
    IGeoDataServer geoDataServer = null;
    while ((serverObjectName = != null){
        if (serverObjectName.getName().equals(serviceName)){
            IName name = (IName)serverObjectName;
            geoDataServer = (IGeoDataServer);
    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.