SOE Elevation LatLon JavaScriptSerializer Online

This sample demonstrates how to use the custom Server Object Extension (SOE) hosted by ArcGIS Server. More information on SOEs can be found here.

The SOE is accessible via the ArcGIS for Server REST API. A web request is programmatically constructed by populating argument\value pairs to match parameters defined by the SOE's REST schema (discoverable via the ArcGIS for Server REST Services Directory). The response from the SOE contains string data in JSON (JavaScript Object Notation) format. There are a variety of techniques for handling JSON in WPF. This sample uses the DataContractJsonSerializer Class to deserialize the JSON response from the server. For more information on the DataContractJsonSerializer see http://msdn.microsoft.com/en-GB/library/system.runtime.serialization.json.datacontractjsonserializer(v=vs.100).aspx. The types to which the JSON is deserialized can be automatically created based on the URL or the returned JSON by using a service such as Json2CSharp (http://json2csharp.com/). Alternatively you can use the JavaScriptSerializer (http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer(v=vs.100).aspx) or there are a number of 3rd party JSON libraries available such as Json.NET (http://james.newtonking.com/projects/json-net.aspx).

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.SOEElevationLatLonJsonObject"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009">
    <Grid x:Name="LayoutRoot">

        <esri:Map x:Name="MyMap" UseAcceleratedDisplay="True" MouseClick="MyMap_MouseClick">
            <esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
        </esri:Map>

        <esri:InfoWindow x:Name="MyInfoWindow"
                         Padding="2"
                         
                         Background="LightYellow"
                         Map="{Binding ElementName=MyMap}" />

    </Grid>
</UserControl>
 

Sample code usage restrictions
5/16/2014