Problem getting the map

988
7
09-03-2013 04:16 AM
angelurbano_rogel
New Contributor
I have a problem with the following line of code, I use a SOE.
 public static IMap getMyMap(IServerObjectHelper serverObject) throws IOException{
  
  IMapServer2 mapServer_2 = (IMapServer2) serverObject.getServerObject();  
  IMapServerObjects2 serverObjs_2 = (IMapServerObjects2) mapServer_2;  
  IMap map = serverObjs_2.getMap(mapServer_2.getDefaultMapName());
  
  return map;
 }

when I run it, I get the following error.
AutomationException: No such interface supported


Can anyone help?, What am I doing wrong?

Thank you.
0 Kudos
7 Replies
LeoDonahue
Occasional Contributor III
If you are working in 10.1 or 10.2, you can't do that anymore.

Scroll down to the SOE section and take note that IMap is not supported.

http://blogs.esri.com/esri/arcgis/2011/04/27/considerations-for-arcgis-server-developers-a-look-towa...


SOE development requires knowledge of ArcObjects,.NET or Java, and  Web service communication technologies such as REST and SOAP. The  ArcObjects SDK has several samples that you can examine, both for Java and .NET.


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). Here is a blog post describing how you can use IMapServerDataAccess to get to the data sources of an MSD-based map service.


0 Kudos
angelurbano_rogel
New Contributor
Thanks for the reply ldonahue.
I'm working with version 10.1.
But if you can not access the IMap within a SOE, neither can access the published FeatureLayer in service?
0 Kudos
LeoDonahue
Occasional Contributor III
Sadly, no.  Not the way you were doing it before.

Before you get that far, you can't even use the same connection method you had before in your SOE either.  Connecting to ArcGIS Server using SOE does not allow servername, username and password anymore.
0 Kudos
angelurbano_rogel
New Contributor
I have a big problem.
Is there any way to know if they are visible or not the fields in a layer? and if it has defined a QueryDefinition?
0 Kudos
LeoDonahue
Occasional Contributor III
I have a big problem.

Join the club.  Membership is free.

Is there any way to know if they are visible or not the fields in a layer? and if it has defined a QueryDefinition?

The blog link I provided indicates we can't do anything mxd related at 10.1 because of the optimized map services.  You have two choices for SOE, the REST API or the SOAP API.

In the SOAP API, I see a QueryFilter, but I don't see QueryDefinition.
http://resources.arcgis.com/en/help/soap/10.2/01vp/01vp00000190000000.htm 

I also see a Field in the SOAP API, but it doesn't have a visible property.
http://resources.arcgis.com/en/help/soap/10.2/01vp/01vp000000p3000000.htm
0 Kudos
LeoDonahue
Occasional Contributor III
LayerDescription
http://resources.arcgis.com/en/help/soap/10.2/01vp/01vp00000105000000.htm


DefinitionExpression:
The LayerDescription includes a  DefinitionExpression. A  DefinitionExpression can be set on a layer in order to limit layer features available for display or query. This only applies for the request and does not replace the definition query set in the source map.


So close...
0 Kudos
angelurbano_rogel
New Contributor
Idonahue Thank you, you helped me a lot.
In the end I managed to get the information required of layer
1. ILayerDescription.getDefinitionExpression () to get the layer DefinitionQuery
2. IMapLayerInfo.getFields () gives me all the fields of the layer visible if I compare with the featureClass.getFields () can identify the fields are visible and not visible.
0 Kudos