extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to...

51
Extending ArcGIS for Server 10.1 services Sterling Quinn @SterlingGIS ArcGIS for Server: Product Engineer

Transcript of extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to...

Page 1: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Extending ArcGIS for Server 10.1 services

Sterling Quinn @SterlingGIS

ArcGIS for Server: Product Engineer

Page 2: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Session overview

• Introduction to server object extensions (SOEs)

• Do you need an SOE?

• Developing an SOE

• Deploying an SOE

• Getting help

Page 3: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Introduction to SOEs

Page 4: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

What is an SOE?

• Server Object Extension

• Extends base functionality of ArcGIS Server using ArcObjects

• A class library you write in .NET or Java and deploy to your server

Page 5: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

SOEs are available when you create a service

Page 6: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Advantages of SOEs

• Functional

• Fast

• Pluggable

• Consumable through REST web services

Page 8: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Detour: Alternatives to SOEs

Page 9: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Building layouts for web printing

• Out-of-the-box PrintingTools service in 10.1

• Arcpy.mapping for advanced printing

Page 10: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Changing symbols on the fly

• “Dynamic layers” capability at 10.1 - Specify drawing information as part of map service

request

• Client-side graphics with Web APIs’ FeatureLayer

Page 11: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Web editing

• Feature service and the Web APIs

Page 12: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Geoprocessing

• ModelBuilder published as geoprocessing service

• Python script tool as geoprocessing service

• Custom geoprocessing tool with .NET, C++, etc.

Page 13: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Geometric calculations

• Geometry service

Page 14: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

When do you need an SOE?

• Need functions beyond out-of-the-box services

• Can’t or don’t want to use geoprocessing framework

• Leverage fast server-side processing using ArcObjects

Page 15: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Developing an SOE

Page 16: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Today we’ll focus on REST Web service SOEs

• Easily invoked by the Esri Web APIs - JavaScript - Flex - Silverlight - iOS - Etc.

Page 17: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

What you have to understand to develop an SOE

• .NET or Java technologies

• REST or SOAP communication

• ArcObjects

• Optional technologies for custom property pages - HTML and JavaScript for Manager pages - Java Swing or Windows Forms, and ArcCatalog

customization, for ArcCatalog pages

Page 18: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Demo: Another SOE in action Spatial Query REST

Page 19: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Steps for developing and deploying an SOE

1. Write the code 2. Optionally write a property page for Manager,

ArcCatalog, or both 3. Deploy the SOE 4. Publish a service and enable the SOE on it 5. Use the SOE in a client application you develop

Page 20: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Writing the code

Page 21: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

An SOE implements the following interfaces

• IServerObjectExtension • IObjectConstruct (put initialization logic here) • IRESTRequestHandler *

* Other interfaces are used with SOAP and DCOM SOEs

Page 22: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Getting started with the code

• REST SOE template in Visual Studio

• Installed with .NET ArcObjects SDK

• Has an example SOE stubbed out for you

Page 23: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Visual Studio REST SOE template

Demo: A tour of the REST SOE template

Page 24: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

What happens in the template code

• Implements required interfaces

• Creates the schema

• Handles resources and operations

Page 25: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

ESRI.ArcGIS.SOESupport

• Helper classes - SoeRestImpl for REST - SoeSoapImpl for SOAP

• Allows for

- Message de/serialization - Error handling - Logging

Page 26: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Creating the schema

• What resources and operations will your SOE expose?

- Resources give you back information - Operations do something

• Snap them together to make a schema

• You may need to diagram this

Page 27: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

SOE capabilities (or “Operations allowed”)

• Determine which schema items clients can access

• Configured as a parameter on schema items RestResource customLayerResource =

new RestResource("customLayers", true, CustomLayer, "GetInfo");

Page 28: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Spatial Query REST SOE Find Near Features REST SOE

Demo: Exploring REST SOE schemas

Page 29: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Writing handler functions

• Each resource and operation has a handler

• Operation handlers are where most of your business logic is invoked

Page 30: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Working with JSON

• Your handlers have to… - Deserialize incoming JSON - Do something with it (often using ArcObjects) - Serialize the output into a JSON response

• Important class: ESRI.ArcGIS.SOESupport.JsonObject

Page 31: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Serialization methods on SOESupport.JsonObject

• Deserialization (receiving a request)

• Serialization (preparing a response)

Page 32: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Conversion methods on SOESupport.Conversion

• These are helpful with (de)serialization

Page 33: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Deserialization in the SpatialQueryREST sample

Page 34: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Serialization in the SpatialQueryREST sample

Page 35: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Spatial Query REST SOE

Demo: JSON serialization

Presenter
Presentation Notes
First show what goes in and what comes out. Then show how this is translated into code.
Page 36: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Accessing map services

• Avoid MXD-specific ArcObjects (IMap, ILayer, etc.) - Carto object model

• Use IMapServerDataAccess to get at underlying data

of MSDs - IFeatureClass, IRaster, or ITable

Page 37: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Spatial Query REST SOE

Demo: Map service access

Page 38: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Deploying an SOE

Page 39: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Deploying and enabling an SOE

• Browse to the .SOE file in Manager to deploy

• Edit any map service properties and check the SOE

• Manager provides text boxes for typing SOE properties

- Custom Manager and ArcCatalog property pages available

Page 40: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Spatial Query REST SOE

Demo: Deploying and enabling an SOE

Page 41: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Deploying an SOE in 10.0

Page 42: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Registering the SOE on each SOC

• Sign and build the project

• Register on each SOC machine with this command: regasm <path to DLL> /codebase • SOC account needs access to DLL location

Page 43: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Registering the SOE with ArcGIS Server

• Done through code using IServerObjectAdmin2.AddExtensionType()

• Re-use the registration app in the SOE SDK samples

• Verify registration by viewing <ArcGIS Server install>\server\system\ServerTypesExt.dat

Page 44: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Using an SOE in a client application

Page 45: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Using the SOE in a client application

• Use types designed for asynchronous HTTP requests to Web services

• Different techniques for JavaScript, Flex, and Silverlight

Page 46: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

JavaScript clients to REST SOEs

• Use esri.request

• Set up content variable with JSON inputs

• Pass content to esri.request, then work with the response object

• Online SDK has a sample

Page 47: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Spatial Query REST SOE

Demo: Using an SOE in a JavaScript app

Page 48: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Where can I get more help?

• Recording of this session will be on Resource Center

• SOE doc is in the ArcObjects SDK developer help

Page 49: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Demo: Help for building SOEs and clients

Page 50: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages

Download today’s demos

• esriurl.com/spatialqueryrest

• esriurl.com/milemarker

Page 51: extending arcgis for server 10.1 services · 2014-06-04 · Session overview • Introduction to ... -Java Swing or Windows Forms, and ArcCatalog customization, for ArcCatalog pages