Select to view content in your preferred language

SOE upgrade to arcgis 10.2

5552
2
07-24-2014 11:39 PM
JorisBeckers
New Contributor

Hi, I'm updating a SOE from pre 10.1 arcgis server to arcgis server 10.2.2. I followed the instructions here and can build my REST SOE in visual studio without problems (for Any CPU as target).

My mapservice works correctly. However, when selecting my SOE as a new capability and restarting that mapservice, I get the message:

object reference not set to an instance of an object

Any ideas on what I have to check to make sure the Mapservice can run with the SOE?

Thanks!

0 Kudos
2 Replies
JorisBeckers
New Contributor

So, i managed to debug my code and it seems the following part is not working anymore:

IMapServer3 mapServer = serverObjectHelper.ServerObject as IMapServer3; IMapServerObjects3 mapServerObjects = mapServer as IMapServerObjects3; IMap map = mapServerObjects.get_Map(mapServer.DefaultMapName); 

I found that pre 10.1, this code would only work for MXD and not for MSD documents. ESRI says this:

All map services now use the fast drawing engine that was associated with MSDs in versions 10.0 and previous.

So it seems logic this piece of code would not work anymore. Anyone has an idea on how I get my IMap variable in 10.2?

Thanks

0 Kudos
nicogis
MVP Frequent Contributor

If you plan on developing new SOEs, keep in mind that in ArcGIS Server 10.1 you will be required to analyze your map documents before publishing them and fix any errors that appear. Thus, one of the things you can do to get your SOE’s ready for 10.1 is to make sure they work against MSDs at 10.0. Building SOE’s on top of MSD based map services with ArcGIS Server 10.0 is perfectly possible. The biggest requirement is that you avoid using MXD-specific interfaces (such as IMap, ILayer, anything to do with page layouts, and so on). http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2010/11/12/Accessing-optimized-map-services-wit...

You can get your featureclass, raster ect using IMapServerDataAccess casting mapServer

Here you can see further details: http://blogs.esri.com/esri/arcgis/2010/11/12/accessing-optimized-map-services-with-server-object-ext...

                IMapServer3 mapServer = (IMapServer3)serverObjectHelper.ServerObject;
                string mapName = mapServer.DefaultMapName;
                IMapLayerInfo layerInfo;
                IMapLayerInfos layerInfos = mapServer.GetServerInfo(mapName).MapLayerInfos;
                // Find the index position of the map layer to query.
                int c = layerInfos.Count;
                int layerIndex = 0;
                for (int i = 0; i < c; i++)
                {
                    layerInfo = layerInfos.get_Element(i);
                    if (layerInfo.Name == m_mapLayerNameToQuery)
                    {
                        layerIndex = i;
                        break;
                    }
                }
               
                IMapServerDataAccess dataAccess = (IMapServerDataAccess)mapServer;
                // Get access to the source feature class.
                IFeatureClass fc = (IFeatureClass)dataAccess.GetDataSource(mapName, layerIndex);
0 Kudos