<?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>
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.
<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>