<allow-http-request-headers-from domain="*.pathfinder-development.com" headers="*"/> <allow-http-request-headers-from domain="*.greatarc.com" headers="*"/> <allow-http-request-headers-from domain="208.70.17.37" headers="*"/> <allow-http-request-headers-from domain="localhost" headers="*"/>
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.soap.mxml.WebService; protected var service:WebService; protected function init():void { service = new WebService(); service.showBusyCursor = true; service.wsdl = "http://data.cmap.illinois.gov/ws/tip/tipservice.asmx?wsdl"; service.addEventListener(ResultEvent.RESULT, onResultsLoaded_handler); service.addEventListener(FaultEvent.FAULT, onFault_handler); service.loadWSDL(); } protected function onFault_handler(event:FaultEvent):void { Alert.show("Error in calling service: " + event.message, "Error"); } protected function onResultsLoaded_handler(event:ResultEvent):void { try { dgResults.dataProvider = event.result as ArrayCollection; } catch (e:Error) { Alert.show("An error occurred loading results: " + e.message, "Results error"); } } protected function btnRequest_clickHandler(event:MouseEvent):void { service.getproject(input.text); } ]]> </mx:Script> <mx:TextInput id="input" width="200" /> <mx:Button id="btnRequest" label="Send Request" width="200" click="btnRequest_clickHandler(event)" /> <mx:DataGrid id="dgResults" width="800" height="300" /> </mx:Application>
Ok, sorry. I got confused reading your earlier posts. Looking at what you have, you actually want to use a WebService, not an HTTPService. You'd use a WebService to send requests to a function and get results. An HTTPService would be used to load something like an XML or Text file.Here is an example of using a WebService with your service. Don't worry about converting to XML unless that's your thing. <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" applicationComplete="init()"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.soap.mxml.WebService; protected var service:WebService; protected function init():void { service = new WebService(); service.showBusyCursor = true; service.wsdl = "http://data.cmap.illinois.gov/ws/tip/tipservice.asmx?wsdl"; service.addEventListener(ResultEvent.RESULT, onResultsLoaded_handler); service.addEventListener(FaultEvent.FAULT, onFault_handler); service.loadWSDL(); } protected function onFault_handler(event:FaultEvent):void { Alert.show("Error in calling service: " + event.message, "Error"); } protected function onResultsLoaded_handler(event:ResultEvent):void { try { dgResults.dataProvider = event.result as ArrayCollection; } catch (e:Error) { Alert.show("An error occurred loading results: " + e.message, "Results error"); } } protected function btnRequest_clickHandler(event:MouseEvent):void { service.getproject(input.text); } ]]> </fx:Script> <s:layout> <s:VerticalLayout gap="5" horizontalAlign="center" paddingTop="25" /> </s:layout> <s:TextInput id="input" width="200" /> <s:Button id="btnRequest" label="Send Request" width="200" click="btnRequest_clickHandler(event)" /> <mx:DataGrid id="dgResults" width="800" height="300" /> </s:Application> Now as far as how this relates to the example you linked in your first post, the above will get you the ArrayCollection of results you were looking for in your first post. Now you can use those results to create a "where" query on your map service.
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" applicationComplete="init()"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.soap.mxml.WebService; protected var service:WebService; protected function init():void { service = new WebService(); service.showBusyCursor = true; service.wsdl = "http://data.cmap.illinois.gov/ws/tip/tipservice.asmx?wsdl"; service.addEventListener(ResultEvent.RESULT, onResultsLoaded_handler); service.addEventListener(FaultEvent.FAULT, onFault_handler); service.loadWSDL(); } protected function onFault_handler(event:FaultEvent):void { Alert.show("Error in calling service: " + event.message, "Error"); } protected function onResultsLoaded_handler(event:ResultEvent):void { try { dgResults.dataProvider = event.result as ArrayCollection; } catch (e:Error) { Alert.show("An error occurred loading results: " + e.message, "Results error"); } } protected function btnRequest_clickHandler(event:MouseEvent):void { service.getproject(input.text); } ]]> </fx:Script> <s:layout> <s:VerticalLayout gap="5" horizontalAlign="center" paddingTop="25" /> </s:layout> <s:TextInput id="input" width="200" /> <s:Button id="btnRequest" label="Send Request" width="200" click="btnRequest_clickHandler(event)" /> <mx:DataGrid id="dgResults" width="800" height="300" /> </s:Application>
var queryTask:QueryTask = new QueryTask(); queryTask.url = "http://data.cmap.illinois.gov/ArcGIS/rest/services/Maps/TIP_Test/MapServer/0";
//************************************************************************* public function runQueryTask(geometry:Geometry):void { //************************************************************************* [INDENT] var queryTask:QueryTask = new QueryTask(); queryTask.url = "http://data.cmap.illinois.gov/ArcGIS/rest/services/Maps/TIP_Test/MapServer/0"; [LEFT]var query:Query = new Query(); query.geometry = geometry; [LEFT]query.returnGeometry = true; query.spatialRelationship = "esriSpatialRelContains"; query.outFields = ['PROID','PROGRAMMIN','COMPLETION'];[/LEFT] [/LEFT] queryTask.execute(query, new AsyncResponder(onXMLResult, onFault)); function onXMLResult(event:ResultEvent, token:Object=null):void{ [INDENT] //xml = event.result.ArrayOfTipproject.tipproject; [LEFT]var xmlListCollection:XMLListCollection = new XMLListCollection; xmlListCollection.source = new XMLList(event.result.ArrayOfTipproject.tipproject); [LEFT]var items:Array = []; foreach(var queryXML:XML in xmlListCollection){[/LEFT] [/LEFT] [INDENT] var obj:Object = { project:queryXML.@PROID, agency:queryXML.@PROGRAMMIN [/INDENT]} [/INDENT]} items.push(obj); [/INDENT]}
var xml:XML = event.result as XML; var items:Array = []; for each (var queryXML:XML in xml.tipProject) { var obj:Object = { project:queryXML.@project, agency:queryXML.@agency // and so on adding the fields you want } items.push(obj); }
private function getproject_result(evt:ResultEvent):void { var pRslt:Object = evt.result; } <mx:WebService id="webService" wsdl="http://data.cmap.illinois.gov/ws/tip/tipservice.asmx?wsdl" showBusyCursor="true"> <mx:operation name="getproject" resultFormat="object" fault="getproject_fault(event);" result="getproject_result(event);"> <mx:request><projectid>{sProjectId}</projectid></mx:request> </mx:operation> </mx:WebService>
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.