ArcGIS Simple Edit service


Purpose
This sample demonstrates how to create an application web service that utilizes remote ArcObjects via ArcGIS for Server, to perform simple edits on a feature class in a geodatabase. In this sample, the feature class contains points (ServiceCalls) and resides in a file geodatabase. The web service accepts the following inputs for adding a new service call:
  • Name
  • Details
  • Service type
  • Location
ArcObjects geodatabase components are used to manage the edit operation in a pooled service environment. Server context is created and released for each web request to the service. The web service requires that  ArcGIS Engine for Windows or ArcGIS for Server Application Developer Framework (ADF) runtime is installed.
A web application is also included with this sample to illustrate how a web ADF client can integrate this service with existing ADF controls and patterns. From the ADF client perspective, a web reference is added to the application, and the service is utilized via a Simple Object Access Protocol (SOAP) interface. The SOAP interface is defined by the web service types and methods. It is not dependent on nor related to the ArcGIS for Server SOAP application programming interface (API).
Since SOAP web services are inherently stateless, server context is created and released upon each request. If the feature class is being edited when another request is received, an error is returned to the client.
Note: Local (DCOM) connections are only supported for ArcGIS Server versions prior to 10.1.

How to use

Data has been provided for your use with this sample. It can be found at <Your ArcGIS Developer Kit Install directory>/Samples/data/Montgomery/MontgomerySimple.mxd.
If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

At design time
  1. Assuming both the web service and application are being installed on the same machine, verify that the web ADF for the .NET Framework is installed and functioning properly. For information on installing and configuring the Web ADF, consult the installation guide.
  2. In Windows Explorer, navigate to <ArcGIS Developer Kit install location>\Samples\ServerNET\ArcGIS_SimpleEdit.
  3. Open the directory of the language you are going to use (that is, CSharp or VBNet) and copy the ArcGIS_SimpleEdit_<language> folder to c:\inetpub\wwwroot. The <language> variable can be CSharp or VBNet.
  4. Set up access to the data by following the steps in the "Set up access to the data" section in this sample.
  5. Create the map service by following the steps in the "Create the map service" section in this sample.
  6. Open the IIS Manager from Control Panel, Administrative Tools, Internet Information Services (IIS) Manager, or Internet Information Services.
  7. In the console tree view on the left, navigate to Local Computer, Web Sites, Default Web Site, or navigate to the web site on which you would like to configure the sample.
  8. Open the ArcGIS_SimpleEdit_<language> folder, right-click the ArcGIS_SimpleEdit_WebService folder, and click Properties. The Properties dialog box appears.
  9. Click the Directory tab, click the Create button in the Application Settings section, then click OK to close the Properties dialog box.
  10. Open the ArcGIS_SimpleEdit_<language> folder, right-click the ArcGIS_SimpleEdit_WebApp<language> folder, and click Properties. The Properties dialog box appears.
  11. Click the Directory tab, click the Create button in the Application Settings section, then click OK to close the Properties dialog box.
  12. Start Visual Studio 2010, and open the ArcGIS_SimpleEdit_<language> solution (for example, ArcGIS_SimpleEdit_CSharp2010.sln) located in c:\inetpub\wwwroot\ArcGIS_SimpleEdit_<language>\ArcGIS_SimpleEdit_<language><vs_version>.
  13. In the Solution Explorer, right-click the ArcGIS_SimpleEdit_WebApp<language> project, and select Set as StartUp Project.
  14. Right-click Default.aspx and select Set As Start Page.
  15. Open the code-behind for the AddActionLocationService.cs (.vb if working in VB.NET) in the webservice project and update the ArcGIS identity username, password, and domain or machine.
  16. Click the Debug menu, click Start Debugging or press F5. The ArcGIS_SimpleEdit application starts.
  17. Address any errors that occur in the debugging process.
  18. Check Layer name in mapservice matches layername used in the code. Also Identity parameters should be changed in AddActionLocationService file under App_code folder.

At run time
  1. Open a browser and navigate to the web application's default page (for example, http://localhost/ArcGIS_SimpleEdit_CSharp/ArcGIS_SimpleEdit_WebAppCSharp/Default.aspx) or start the Web application in Visual Studio.
  2. Type a value in the Service Name and Service Details text boxes. Service Name is the name of the customer, and Service Details contains specific information about the service call. Use the Service Type drop-down menu to select the service call type.
  3. Select the Add Service Call tool and click the map. A new service call with the parameters you added is added to the map.
  4. Use the Identify Service Call tool to query current service calls in the ServiceCalls feature class. The results are returned in a table below the map.

Additional information

Set up access to the geodatabase

Do the following:
  1. You must have access to SQLExpress, configured for use with ArcSDE workgroup geodatabases, to use the data packaged with this sample. If you use your data, you need to change portions of the sample code for it to function.
  2. Start ArcCatalog, click Add Database Server under Database Servers, and connect to SQLExpress.
  3. Right-click the SQLExpress instance, select Permissions, and add the ArcGIS Server container account.
  4. Right-click the SQLExpress instance, select Attach, and navigate to the Montgomery.mdf file included the samples data (for example, c:\iArcGIS\ProgramFiles\DeveloperKit10.0\Samples\Data\Montgomery.mdf). The Montgomery geodatabase is added to the geodatabase list for the SQLExpress instance in ArcCatalog.
  5. Right-click the Montgomery geodatabase, select Administration, Permissions, then grant the ArcGIS Server container account (ArcGISSOC) read/write privileges. 

Configure the map document and create the map service

Do the following:
  1. Open the MontgomerySimple.mxd file in ArcMap. Because the data source for every layer is invalid, a red exclamation point shows next to each layer name.
  2. Click the red exclamation point next to the Dimension features layer. The Set Data Source dialog box appears. See the following screen shot:


  3. Navigate to the SQLExpress instance where the Montgomery geodatabase is available, select the Montgomery.DBO.Dimensions feature class in the Montgomery.DBO.Landbase feature dataset, then click OK. Data sources for the layers in the map document are repaired.
  4. Save the map document. The following screen shot shows how the ArcMap window looks:


  5. Open ArcCatalog and add a new map service with the following properties:
    • Name—MontgomerySimple
    • Map document—<path to MontgomerySimple.mxd>
    • Pooling—Pooled, Min instances: 0, Max instances 2
  6. Start the service.


ArcGIS_SimpleEdit_CSharp\ArcGIS_SimpleEdit_WebService\AddActionLocation.asmx Web service endpoint.
ArcGIS_SimpleEdit_CSharp\ArcGIS_SimpleEdit_WebService\App_Code\AddActionLocationService.cs Web service source code. Defines the public members and types, as well as process logic.
ArcGIS_SimpleEdit_CSharp\ArcGIS_SimpleEdit_WebAppCSharp\Default.aspx Default page contains a set of custom tools to add a service call and identify existing service calls.
ArcGIS_SimpleEdit_CSharp\ArcGIS_SimpleEdit_WebAppCSharp\Default.aspx.cs Code behind the user interface (UI).
ArcGIS_SimpleEdit_CSharp\ArcGIS_SimpleEdit_WebAppCSharp\App_Code\AddPointTool.cs Contains tool code used to add a service call using the web service.
ArcGIS_SimpleEdit_CSharp\ArcGIS_SimpleEdit_WebAppCSharp\App_Code\IdentifyTool.cs Contains tool code used to identify existing service calls via the map service.
ArcGIS_SimpleEdit_CSharp\ArcGIS_SimpleEdit_WebAppCSharp\App_Code\Utility.cs Class library containing helper code.
Download the C# files
ArcGIS_SimpleEdit_VBNet\ArcGIS_SimpleEdit_WebService\AddActionLocation.asmx Web service endpoint.
ArcGIS_SimpleEdit_VBNet\ArcGIS_SimpleEdit_WebService\App_Code\AddActionLocationService.vb Web service source code. Defines the public members and types, as well as process logic.
ArcGIS_SimpleEdit_VBNet\ArcGIS_SimpleEdit_WebAppVBNet\Default.aspx Default page contains a set of custom tools to add a service call and identify existing service calls.
ArcGIS_SimpleEdit_VBNet\ArcGIS_SimpleEdit_WebAppVBNet\Default.aspx.vb Code behind the user interface (UI).
ArcGIS_SimpleEdit_VBNet\ArcGIS_SimpleEdit_WebAppVBNet\App_Code\AddPointTool.vb Contains tool code used to add a service call using the web service.
ArcGIS_SimpleEdit_VBNet\ArcGIS_SimpleEdit_WebAppVBNet\App_Code\IdentifyTool.vb Contains tool code used to identify existing service calls via the map service.
ArcGIS_SimpleEdit_VBNet\ArcGIS_SimpleEdit_WebAppVBNet\App_Code\Utility.vb Class library containing helper code.
Download the VB.NET files

Download the files for all languages