Find Nearby Features SOAP Server Object Extension
arcgissamples\soe\soapclient\FindNearbyFeaturesSOAPClient.java
/* Copyright 2010 ESRI
* 
* All rights reserved under the copyright laws of the United States
* and applicable international laws, treaties, and conventions.
* 
* You may freely redistribute and use this sample code, with or
* without modification, provided you include the original copyright
* notice and use restrictions.
* 
* See the use restrictions.
* 
*/
package arcgissamples.soe.soapclient;

import arcgissamples.soe.FindNearbyFeaturesSOEServiceBindingStub;

import com.esri.arcgisws.PointN;
import com.esri.arcgisws.Record;
import com.esri.arcgisws.RecordSet;

public class FindNearbyFeaturesSOAPClient
{
  public static void main(String[] args)
  {
    FindNearbyFeaturesSOEServiceBindingStub stub = new FindNearbyFeaturesSOEServiceBindingStub("http://localhost:8399/arcgis/services/portland/MapServer/FindNearbyFeaturesSOE");
    //stub.enableRequestResponseLogging(true);
    System.out.println("\nFinding features near location 7643274.467, 682498.886...");
    
    PointN point = new PointN();
    point.setX(7643274.467);
    point.setY(682498.886);
    
    RecordSet recordSet = stub.findNearbyFeatures(18, point, 500);
    Record[] records = recordSet.getRecords();
    
    System.out.println("Found " + records.length + " records.");
    
    for(Record record : records)
    {
      Object[] values = record.getValues();
      for(Object value : values)
      {
        if(value instanceof PointN)
        {
          PointN newPoint = (PointN) value;
          System.out.print("Point: " + newPoint.getX() + ", " + newPoint.getY());
        }
        else
        {
          System.out.print(value.toString() + "\t");
        }
      }
      System.out.println("");
    }
  }
}