This document is archived and information here might be outdated.  Recommended version.


How to migrate a .NET server object extension to the latest release (ArcObjects .NET 10.4 SDK)

How to migrate a .NET server object extension to the latest release


Migrating a .NET server object extension from version 10.1

SOEs built with ArcGIS 10.1 can be deployed with 10.2; in fact you do not even need to redeploy them after 10.2 is installed.
If you have an SOE project that you made with 10.1 and you make edits after installing 10.2, you should rebuild and redeploy the SOE with 10.2.

Migrating a .NET server object extension from version 10.0 or earlier

Migrating an SOE that was created in version 10.0 or earlier requires that you copy most of your SOE code into the latest Visual Studio templates for Representational State Transfer (REST) or Simple Object Access Protocol (SOAP) SOEs. The reason you need to do this is because the new templates contain the packaging logic to make a .soe file. This file was introduced at 10.1 and allows you to deploy your SOE to ArcGIS for Server in one step. The .soe file is created when you build the project.
Another advantage of the new template is that the references are already pointing at primary interop assemblies (PIAs) shipped with the ArcObjects software development kit (SDK). If your project requires any references other than those included in the template, you need to manually add those references.
SOEs created in versions 10.0 and earlier that rely on ArcGIS Server Local (Distributed Component Object Model [DCOM]) connections cannot be used in later versions of ArcGIS. These SOEs should be refactored to act as REST or SOAP Web services.
The steps for migrating an SOE from 10.0 to a later version are as follows:
  1. If the SOE was previously registered on your machine, unregister it using a command such as regasm <path to DLL> /codebase /u.
  2. Open Visual Studio 2010 and click File > New > Project.
  3. In the Installed Templates tree, expand Visual C# > ArcGIS > Server Object Extensions.
  4. At the top of the New Project dialog box, choose .NET Framework 3.5 from the drop-down list.
  5. Choose between the REST or SOAP templates, type a name and location for your SOE, then click OK.
  6. Add any references and directives your project requires that are not already included in the template.
  7. In the template, modify the .NET attribute ServerObjectExtension to contain the capabilities (allowed operations), description, display name, properties, and supported Web service architectures for your SOE. These are the kinds of values that you set in your SOE registration code at 10.0 and earlier. A C# SOE might look like the following code example:
[C#]
[ServerObjectExtension("MapServer", AllCapabilities="GetCommonInfo;GetSecretInfo",
    DefaultCapabilities="GetCommonInfo", Description=
    "An example SOE for the help system", DisplayName="My Sample SOE", Properties 
   ="PropertyA=500;PropertyB=Cities", SupportsREST=true, SupportsSOAP=false)]
  1. Copy the entire class code (but not the class declaration) from your pre-10.1 SOE and replace the corresponding code in the template. The boilerplate class code in the template is identical to the 10.0 code except that SOEs no longer derive from ServicedComponent nor do they require a reference to System.EnterpriseServices. You should remove these items if you do a complete copy and paste. You can use the most recent template and samples as a guide.
The following code example shows what you should remove and replace with your 10.0 code when migrating a C# REST SOE:
[C#]
public class MySampleSOE: IServerObjectExtension, IObjectConstruct,
    IRESTRequestHandler
{
    // Delete template code and paste your 
    //   corresponding 10.0 code here.
}
If your migrated SOE has a different name than your 10.0 SOE, update the SOE name in the constructor. See the following code example:
[C#]
public MySampleSOE()
{
    soe_name=this.GetType().Name;
    logger=new ServerLogger();
    reqHandler=new SoeRestImpl(soe_name, CreateRestSchema())as IRESTRequestHandler;
}
  1. Save your solution and build your project. This creates a .soe file under your project's bin directory.
  2. Deploy your SOE to ArcGIS for Server using the instructions in How to deploy a server object extension to ArcGIS Server.