Call a web service and assign returning value to form controls
<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".
This user guide is licensed for use under the terms of the Creative Commons Attribution
Non-Commercial 3.0 License.
This License allows users to copy, distribute, and transmit the user guide for noncommercial
purposes only so long as
(1) proper attribution to Adobe is given as the owner of the user guide; and
(2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms.
The best way to provide notice is to include the following link.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/
-->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Declarations>
<s:WebService id="WeatherService"
wsdl="http:/example.com/ws/WeatherService?wsdl" useProxy="false">
<s:operation name="GetWeather">
<s:request>
<ZipCode>{zip.text}</ZipCode>
</s:request>
</s:operation>
</s:WebService>
</fx:Declarations>
<s:Panel title="My Application">
<s:VGroup left="10" right="10" top="10" bottom="10">
<!-- Provide a ZIP code in a TextInput control. -->
<s:TextInput id="zip" width="200" text="Zipcode please?" />
<!-- Call the web service operation with a Button click. -->
<s:Button width="60" label="Get Weather"
click="WeatherService.GetWeather.send();" />
<!-- Display the location for the specified ZIP code. -->
<s:Label text="Location:" />
<s:TextArea
text="{WeatherService.GetWeather.lastResult.Location}" />
<!-- Display the current temperature for the specified ZIP code. -->
<s:Label text="Temperature:" />
<s:TextArea
text="{WeatherService.GetWeather.lastResult.CurrentTemp}" />
</s:VGroup>
</s:Panel>
</s:Application>
Related examples in the same category