Using Web Services with Flash MX 2004 - MD ColdFusion User's ...

fishnibblersspongyΛογισμικό & κατασκευή λογ/κού

14 Δεκ 2013 (πριν από 7 χρόνια και 8 μήνες)

218 εμφανίσεις

Using Web Services in Flash
MX 2004 Pro

in 60 Minutes or Less

Theo Rushin Jr

Web Application Developer/Trainer

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

I can be reached at

or on the snow

Presentation Agenda

An introduction to Web Services

Flash MX 2004 and Web Services

Six Easy Steps

Now It’s Your Turn

According Wikipedia, the free (and mostly
accurate) online encyclopedia;

“What is a Web Service?”

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
process communication on a single

“Why should I consume web

The major reasons for using Web services are to gain:

Interoperability among distributed applications that span
diverse hardware and software platforms.


Accessibility of applications through firewalls using Web


A cross
platform, cross
language data model (XML) that
facilitates developing heterogeneous distributed

“What are some of the standards




“I think I know what XML is”

Extensible Markup Language (XML) is a
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.

“So what is

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.

“And what is WSDL?”

WSDL (Web Service Description Language

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

“What are some of the advantages
of using web services?”

Web services provide interoperability between various software applications
running on disparate platforms.

Web services use open standards and protocols. Protocols and data
formats are text
based where possible, making it easy for developers to

By utilizing HTTP, web services can work through many common firewall
security measures without requiring changes to the firewall filtering rules.

Web services easily allow software and services from different companies
and locations to be combined easily to provide an integrated service.

Web services allow the reuse of services and components within an

“What are some of the disadvantages
of using web services?”

Web services standards for features such as
transactions are currently nonexistent or still in their
infancy compared to more mature distributed computing
open standards such as CORBA.

Web services suffer from poor performance compared to
other distributed computing approaches such as RMI,
CORBA, or DCOM. This is a common trade
off when
choosing text
based formats.

By utilizing HTTP, web services can evade existing
firewall security measures whose rules are intended to
block or audit communication between programs on
either side of the firewall.

“Where can I find some publicly
accessible web services?”

Flash MX 2004 and Web Services

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

Flash MX 2004 and Web Services

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.

“Are there any disadvantages to
consuming web services within

Both of the methods for connecting to web
services in Flash MX 2004 have a couple of

Can be slow when returning large datasets

The security features of Flash could prevent
access to web service …

When returning large datasets

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

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.



Cross domain policy

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)

Cross domain policy

So why should I even use Flash?

(instead of ColdFusion, ASP.NET, etc.)

Greater degree of interactivity.

Combine audio and video to produce a richer

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!

“What do I need to do to get

Discover the web service.

Deploy the user interface components.

Register the web service in Flash.

Configure the WebServiceConnector.

Bind the user interface components to the

Trigger the WebServiceConnector.

And That’s It!

And Now On With The Show!

Additional Reading

Macromedia Flash MX Professional
2004 Application Development:
Training from the Source

Macromedia Flash MX 2004
Professional for Server Geeks