
About MXML
29
The following figure shows the application rendered in a web browser window after the user clicks
the Submit button:
As an alternative to the curly braces ({ }) syntax, you can use the
<mx:Binding>
tag, in which you
specify the source and destination of a binding. For more information about data binding, see
Chapter 32, “Binding and Storing Data in Flex,” in
Developing Flex Applications
.
Using data services
Flex is designed to interact with several types of services that provide access to local and remote
server-side logic. For example, a Flex application can connect to a web service that uses the Simple
Object Access Protocol (SOAP), a Java object residing on the same application server as Flex using
AMF, or an HTTP URL that returns XML. AMF is the protocol used in Flash Remoting MX.
The MXML components that provide data access are called
data service components
. MXML
includes the following types of data service components:
•
WebService
provides access to SOAP-based web services
•
HTTPService
provides access to HTTP URLs that return data
•
RemoteObject
provides access to Java objects using the AMF protocol
The following example shows an application that calls a web service that provides weather
information, and displays the current temperature for a given ZIP code. The application binds
the ZIP code that a user enters in a TextInput control to a web service input parameter. It binds
the current temperature value contained in the web service result to a TextArea control.
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" >
<!-- Define the web service connection
(the specified WSDL URL is not functional). -->
<mx:WebService id="WeatherService"wsdl="/ws/WeatherService?wsdl">
<!-- Bind the value of the ZIP code entered in the TextInput control
to the ZipCode parameter of the GetWeather operation. -->
<mx:operation name="GetWeather">
<mx:request>
<ZipCode>{zip.text}</ZipCode>
</mx:request>
</mx:operation>
</mx:WebService>
<mx:Panel title="My Application" marginTop="10" marginBottom="10"
marginLeft="10" marginRight="10" >
Summary of Contents for FLEX-GETTING STARTED WITH FLEX
Page 1: ...Getting Started with Flex...
Page 4: ...4 Contents...
Page 22: ...22 Chapter 1 Introducing Flex...