Using Web Services in Flash MX 2004 Pro. in 60 Minutes or Less. Theo Rushin Jr Web Application Developer/Trainer.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Using Web Services in Flash MX 2004 Pro
in 60 Minutes or Less
I am an avid snowboarder and skier always looking for the deep powder. When I’m not carving my way through the trees or dreaming of the next big snowfall, I work as a consultant at the National Institutes of Health (NIH) where I lead the design and development of many web-based solutions.
I have spent the past 6 years establishing myself as an expert Coldfusion and Flash Rich Internet Application Developer and Trainer. During my 6 years of web application development I have created and supported many enterprise-wide web-based applications.
I can be reached at firstname.lastname@example.org on the snow
According Wikipedia, the free (and mostly accurate) online encyclopedia;
A web service is a collection of protocols and standards used for exchanging data between applications or systems. Software applications written in various programming languages and running on various platforms can use web services to exchange data over computer networks like the Internet in a manner similar to inter-process communication on a single computer.
The major reasons for using Web services are to gain:
2.Accessibility of applications through firewalls using Web protocols.
3.A cross-platform, cross-language data model (XML) that facilitates developing heterogeneous distributed applications.
Extensible Markup Language (XML) is a general-purpose markup language for creating special-purpose markup languages. It is capable of describing many different kinds of data. Its primary purpose is to facilitate the sharing of data across different systems, particularly systems connected via the Internet.
SOAP (Simple Object Access Protocol) defines the XML based message format that applications use to communicate and inter-operate with each other over the internet. The heterogeneous environment of the internet demands that applications support a common data encoding protocol and message format. SOAP makes object access simple by allowing applications to invoke object methods, or functions, residing on remote servers. A SOAP application creates a request block in XML, supplying the data needed by the remote method as well as the location of the remote object itself.
WSDL (Web Service Description Language - often pronounced "Whiz-Dull".), the proposed standard for how a Web service is described, is an collection of metadata about XML-based service used for describing what business do and how to access their services electronically. We can say WSDL is a XML- Based service IDL (Interface Definition Language) that defines the service interface and its implementation characteristics. WSDL describes the SOAP messages that define a particular Web service.
Macromedia Flash MX Professional 2004 provides a powerful, rapid development tool for building web service consumers. New tools and components in Flash MX Professional 2004 simplify and speed the development of web service-based applications.
Flash MX 2004 comes with two client side methods for connecting to web services. The first is by using the WebServiceConnector component, the second is by using the web service classes and actionscript.
Both of the methods for connecting to web services in Flash MX 2004 have a couple of disadvantages.
It can be really slow when returning larger datasets (1000+). The reason for this is that, even with the MX 2004 speed improvements, it can take a lot of processor power to convert the returned xml into flash actionscript objects. When returning large result sets from a web service it is a far better solution to go with Flash Remoting. Flash remoting will return the result set as AMF instead of XML which has a much faster transfer speed (much more compressed) and does not need to be converted to flash actionscript (as it already is).
In a nutshell …
The AMF protocol, which is proprietary to Macromedia, is a very lightweight binary format that cuts the bulk out of packets, meaning data exchange is a lot faster than with XML.
The second disadvantage of using the new built in client side web service features of Flash MX 2004 are the security features. In order to use a web service that is not located on the same server, the owner of that service would need to place a cross domain policy file allowing the flash movie access to it's service.
Since you asked …
For security reasons, a Macromedia Flash movie playing in a web browser is not allowed to access data that resides outside the exact web domain from which the SWF originated. A cross-domain policy file is a simple XML file that gives the Flash Player permission to access data from a given domain without displaying a security dialog. When placed on a server, it tells the Flash Player to allow direct access to data on that server, without prompting the user grant access.
(Macromedia TechNote tn_14213)
You don’t have to choose!
You can leverage your existing server-side code, written in Coldfusion, .Net, PHP, etc., to consume web services using Flash MX 2004!
And That’s It!
And Now On With The Show!