
CHAPTER 5
Working with the Server
Most Flex applications
are going to work with a web server in
some shape or form. Thankfully, Flex makes this very easy to
do by providing a rich set of web service tools. In this chapter,
I’ll present two methods of accessing the server from a Flex
application, and the server code that is required to support
them.
You can access the server in a Flex application in five different
ways:
POST or GET
You can use a Flex application just as you would an HTML
form. Flex can bundle up the elements in a form and post
them to your web server application just as the browser
would. Your application won’t even know the difference.
Using HTTP services directly
In a manner similar to Ajax, you can make an HTTP re-
quest of the server, even supplying POST content, and re-
ceive the response asynchronously. That response can be
whatever flavor of data you want: text, XML, YAML,
JSON, whatever you like. For JSON data the as3corelib
library (http://code.google.com/p/as3corelib/) provides an
excellent JSON interpreter.
SOAP
Flex can access SOAP services directly using a set of Flex
classes designed specifically for that purpose.
67
Kommentare zu diesen Handbüchern