SOE: how to query features from a feature Layer of MapService

725
0
08-26-2013 06:28 AM
SimonLeo
New Contributor III
Hi,

I have a SOE that is enabled on a MapService. This map service has one feature layer. what I am trying to do is to query features in this feature layer during SOE request process. I tried following query function:
public ICursor PerformAttributeQuery(ITable table, string whereClause)
        {
            if (table == null)
            {
                return null;
            }
            IQueryFilter queryFilter = new QueryFilterClass();
            queryFilter.WhereClause = whereClause; // create the where clause statement

            try
            {
                // query the table passed into the function and use a cursor to hold the results
                ICursor cursor = table.Search(queryFilter, false);

                return cursor;
            }
            catch (Exception ex)
            {
            }

            return null;
        }


I used IMapServerDataAccess.GetDataSource to get this feature layer;

Then this function is called to query a given feature layer, such as:
ICursor cursor = PerformAttributeQuery((ITable)featureLayer, "OBJECTID = 120");
 if (cursor != null)
{
    //processing

    //release cursor
    Marshal.ReleaseComObject(cursor);
}


But during the query, I got the error saying:
The workspace is not connected

I also tried directly using SpatialQuery via IFeatureClass.Search but didn't work either.

I feel maybe featureclass query is only partly supported in SOE environment?

does anybody have some inputs on this one? thank you!
Tags (2)
0 Kudos
0 Replies