How can you make a spatial query against a MAP SERVICE layer in ArcGIS Engine app?

Discussion created by gsinner on May 10, 2011
We have a web application built using the ArcGIS API for Silverlight. In it we use QueryTask to perform spatial queries against map service layers.

We also have a desktop application built using ArcGIS Engine Runtime. In it we make spatial queries against featureclasses in geodatabases using the IFeatureClass.Search method and the SpatialFeatureClass.

How can we make similar spatial queries against map service layers in our ArcGIS Engine Runtime desktop application? We need to return ???full??? objects ??? meaning that we get back *REAL* attributes *AND* geometry. If we add the same map services that work in our web app to our desktop app, the map service layers display correctly on the map. But they don???t support IFeatureClass, so we can???t use IFeatureClass.Search. They are MapServerQuerySublayer objects, but neither the IFind nor the IIdentify interfaces can return the actual geometry. I???m currently using IIdentify2 to return attributes, and the attributes include a ???Shape??? property, but the value for the Shape property is just a string containing the type of geometry (???point???, ???polyline???, etc.).

So to rephrase my question: Is there *ANY* way in an ArcGIS Engine based desktop application to query a map service layer and get back the actual geometry (points and spatial reference) like you can do in the Silverlight API with QueryTask?

And a follow-up question, is there *ANY* way to get the attributes back as the proper data types (even the numeric data comes back from Identify() as strings)?

One more: is there any way to make the select tool in ArcMap be able to select features from a map service? Not identify - need to do a real *SELECT* action.