Flex/WS: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
Exemple d'usage d'un WebService dans une application Flex |
Exemple d'usage d'un WebService dans une application Flex |
||
[[File:Test3.swf]] |
|||
<pre> |
<pre> |
||
Latest revision as of 00:09, 8 March 2011
Exemple d'usage d'un WebService dans une application Flex
<?xml version="1.0" encoding="utf-8"?>
<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">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
public var weather:Namespace =
new Namespace("http://www.webserviceX.NET");
]]>
</fx:Script>
<fx:Declarations>
<s:WebService id="WeatherService"
wsdl="http://www.webservicex.net/globalweather.asmx?WSDL"
useProxy="false"
fault="Alert.show(event.fault.faultString), 'Error on http://www.webservicex.net/globalweather.asmx?WSDL'"
>
<s:operation name="GetCitiesByCountry" resultFormat="e4x">
<s:request>
<CountryName>{CountryName.text}</CountryName>
</s:request>
</s:operation>
<s:operation name="GetWeather">
<s:request>
<CityName>{CityName.text}</CityName>
<CountryName>{CountryName.text}</CountryName>
</s:request>
</s:operation>
</s:WebService>
</fx:Declarations>
<mx:VBox>
<s:Label text="Country Name:"/>
<s:TextInput id="CountryName" width="200" text="France"/>
<s:Label text="City Name:"/>
<s:TextInput id="CityName" width="200" text="Cannes"/>
<!-- Call the web service operation with a Button click. -->
<s:Button width="60" label="Get Weather" click="WeatherService.GetWeather.send();"/>
<s:Label text="Doc:"/>
<s:TextArea text="{WeatherService.GetWeather.lastResult}"/>
</mx:VBox>
</s:Application>