Chapter 18. Working with Services and Server-Side Communication

One of the most important aspects of working with Flex is communicating with a server and database. 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 XML or character strings that are returned from the request. 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 via ActionScript Message Format objects. RemoteObjects also can communicate 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 properties of the service, setting the URL of the server that will be used ...

Get Flex 3 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.