User Guide
136 Chapter 6: Working with Data
Working with Flex data services
After inserting the components that make up your user interface, (see Chapter 4, “Building a Flex
User Interface Visually,” on page 95), you can use Flex data services to bind the user interface to
the business layer. A Flex data service acts as a bridge to the business layer. For more information,
see “Flex data services” on page 152.
After binding a data service to an object in the business layer, you can pass data between them.
For example, you can collect information from users and submit it to the business layer, or
retrieve and display information from the business layer.
Before you begin, make sure Flex Builder can connect to your Flex server. Certain features
discussed in this section will not work if a Flex testing server is not properly defined in Flex
Builder. For information on defining a testing server, see “Starting a new application in Flex
Builder” on page 9.
This section covers the following topics:
• “Inserting a Flex data service in the MXML file” on page 136
• “Binding a Flex data service to an object” on page 137
Related topics
• “Data binding in Flex” on page 150
Inserting a Flex data service in the MXML file
To pass data to and from the business layer, you must first insert a Flex data service into the
MXML file. A Flex data service encapsulates a web service, an HTTP service, or a Java object.
The role of a Flex data service is to communicate with the business layer.
To insert a Flex data service in an MXML file:
1.
With the MXML file open in Flex Builder, open the Data panel (Window > Data).
2.
Click the Plus (+) button on the panel and select the type of object in your business layer that
will provide or receive the data.
Web Service inserts a service that lets you access the methods of a SOAP-compliant web
service.