Chapter 15. Working with Services and Server-Side Communication
One of the most important aspects of working with Flex is communicating with a server and its exposed service methods. The recipes in this chapter focus mainly on configuring a Flex application to communicate with servers and processing data sent to the application from a server, in one of the three main ways that servers and applications communicate.
Flex provides three classes to communicate with servers: HTTPService
, RemoteObject
, and WebService
. The HTTPService
class facilitates communication with a
server using the Hypertext Transfer Protocol (HTTP). A Flex application can
use GET
or POST
requests to send data to a server and process
the XML or character strings that are returned from the requests. With the
HTTPService
class, you can communicate
with PHP pages, ColdFusion pages, JavaServer Pages (JSP), Java servlets,
Ruby on Rails, and Microsoft Active Server Pages (ASP). You can use the
RemoteObject
class for communicating with
a server using ActionScript Message Format (AMF), with Java or ColdFusion
remoting gateways, or with .NET and PHP by using open source projects such
as AMFPHP, SabreAMF, or WebORB. The WebService
class communicates with a web service
that defines its interface by using the Web Services Description Language
(WSDL) and uses either SOAP-based XML or XML.
To create a service component, you need to configure the service by specifying the URL of the server that will be used to send requests and ...
Get Flex 4 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.