Until now, the data that you have been displaying (available products, categories, sales data, and so on) has come from XML feeds or written into the application via MXML/ActionScript. In the real world, every application that you write will have three logic areas: the client, the business logic (logic that implements the requirement of the system), and the data it runs on. Although Adobe Flex is a great platform for developing your rich-client interface and can also be used to write business logic, from an architectural standpoint it is sometimes best to put your core business logic outside of your Flex application. For example, have the process that does a real-time evaluation of a checked-out state on a piece of data reside on the server and be called by the client before using access data to make sure it can still be used. In this example, you see it is best to implement the central business rules and data access in a location in which all the users accessing the system will have access. This best practice can be implemented in a variety of technologies and accessed from Flex in several different ways. Confirmation screen after adding a new product In this lesson, you will initially learn how to access code (server-side objects) written on the server to retrieve data to feed the Dashboard, update product information, and place an order. Then you will learn how the <mx:WebService> and <mx:RemoteObject> tags enable you to use both an industry standard and an open binary protocol to call this Server object. Because the data that defines a product is its picture, you will implement the ability to upload a file. Finally, you will write some high-level architectural features to assist you with centralizing your server access and passing data between the client and server tiers. The previous example shows the confirmation screen after a new product is added. From this lesson going forward, all external access from the application will be using the local ColdFusion instance. Please refer to the appendix, "Setup Instructions," to learn how to install, set up, and run the ColdFusion server instance and application. |