arcgissamples\soe\soapclient\JavaFindNearbyFeaturesSOAPClient.java
/* Copyright 2015 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 at <your ArcGIS install location>/DeveloperKit10.4/userestrictions.txt. * */ package arcgissamples.soe.soapclient; import arcgissamples.soe.JavaFindNearbyFeaturesSOAPSOEServiceBindingStub; import com.esri.arcgisws.PointN; import com.esri.arcgisws.Record; import com.esri.arcgisws.RecordSet; public class JavaFindNearbyFeaturesSOAPClient { public static void main(String[] args) { if (args.length != 2) { System.out .println("Correct usage is: JavaFindNearbyFeaturesSOAPClient <name of server> <name of map service>"); } else { String serverName = args[0]; String serviceName = args[1]; String url = "http://" + serverName + ":6080/arcgis/services/" + serviceName + "/MapServer/JavaFindNearbyFeaturesSOAPSOE"; JavaFindNearbyFeaturesSOAPSOEServiceBindingStub stub = new JavaFindNearbyFeaturesSOAPSOEServiceBindingStub( url); stub.enableRequestResponseLogging(true); /* * Modify coordinates below based on the spatial reference of * your map service */ System.out .println("\nFinding features near location -102.88189, 45.98543..."); PointN point = new PointN(); point.setX(-49.2550048828125); point.setY(-16.72698974609375); RecordSet recordSet = stub.findNearbyFeatures(1, point, 2); 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("\nPoint: " + newPoint.getX() + ", " + newPoint.getY()); } else { System.out.print(value.toString() + "\t"); } } } } } }