private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //create instance of proxy
                var nearFeatsService = new localhost.USA_NetFindNearFeaturesSoapSOE();
                nearFeatsService.Url ="http://localhost:6080/arcgis/services/USA/MapServer/NetFindNearFeaturesSoapSOE";

                //getLayerInfos
                CustomLayerInfo[] layerInfos = nearFeatsService.GetLayerInfos();

                foreach (CustomLayerInfo layerInfo in layerInfos)
                {
                    EnvelopeN extent = (EnvelopeN) layerInfo.Extent;

                    debug(
                        string.Format("Layer {0} has ID: {1} and extent: {2},{3},{4},{5}",
                                      layerInfo.Name, layerInfo.ID, extent.XMin, extent.YMin, extent.XMax, extent.YMax));
                }


                //findNearFeatures
                CustomLayerInfo aLayerInfo = layerInfos[0];

                PointN location;
                double distance;
                GetCenterPointAndDistance((EnvelopeN) aLayerInfo.Extent, out location, out distance);

                RecordSet feats = nearFeatsService.FindNearFeatures(aLayerInfo.ID, location, distance);

                foreach (Record record in feats.Records)
                {
                    foreach (object o in record.Values)
                        if (o != null)
                            debug(o.ToString() + ", ");
                    debug("\n");
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            richTextBox1.Clear();

            var infos = new List<CustomLayerInfo>()
            {
                new CustomLayerInfo
                {
                    Extent = new EnvelopeN
                    {
                        XMin = 0,
                        YMin = 0,
                        XMax = 100,
                        YMax = 999
                    },
                    ID = 123,
                    Name = "Custom Layer Object 1"
                }
                ,new CustomLayerInfo
                {
                    Extent = new EnvelopeN
                    {
                        XMin = 101,
                        YMin = 101,
                        XMax = 202,
                        YMax = 202
                    },
                    ID = 456,
                    Name = "Custom Layer Object 2"
                }
            };

            var nearFeatsService = new localhost.USA_NetFindNearFeaturesSoapSOE();
            nearFeatsService.Url = "http://localhost:6080/arcgis/services/USA/MapServer/NetFindNearFeaturesSoapSOE";

            var result = nearFeatsService.DemoArrayOfCustomObjectsInput(infos.ToArray());

            foreach (var info in result)
            {
                var extent = (EnvelopeN)info.Extent;

                debug(
                    string.Format("Layer {0} has ID: {1} and extent: {2},{3},{4},{5}",
                                  info.Name, info.ID, extent.XMin, extent.YMin, extent.XMax, extent.YMax));
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            richTextBox1.Clear();

            var info = new CustomLayerInfo
                           {
                               Extent = new EnvelopeN
                                            {
                                                XMin = 0,
                                                YMin = 0,
                                                XMax = 100,
                                                YMax = 999
                                            },
                               ID = 123,
                               Name = "Custom Layer Object"
                           };

            var nearFeatsService = new localhost.USA_NetFindNearFeaturesSoapSOE();
            nearFeatsService.Url ="http://localhost:6080/arcgis/services/USA/MapServer/NetFindNearFeaturesSoapSOE";


            var result = nearFeatsService.DemoCustomObjectInput(info);

            var extent = (EnvelopeN) result.Extent;

            debug(
                string.Format("Layer {0} has ID: {1} and extent: {2},{3},{4},{5}",
                              result.Name, result.ID, extent.XMin, extent.YMin, extent.XMax, extent.YMax));

        }