Web Services are all about communication between diverse systems over a network. A Web Service is simply a program that is accessible over a network for use by other programs. This accessibility is achieved by outputting information in standard XML format. By utilizing XML, Web Services written in one program language residing on a server can speak to other programs written in entirely different languages which reside on another server or client that may be running a completely different operating system.
A Web Service has three elements:
Web Service Description Language (WSDL) – describes the functions available from a Web Service and the content of any messages sent from the service
SOAP – the protocol that describes the format of messages sent to and from a service
Universal Description, Description and Integration (UDDI) – the standard used by developers for publishing Web Services.
For our purposes you really only need to worry about a service's WSDL as this document will tell us what methods or functions we can call in order to retrieve information from the service.
There are countless Web Services available and for this exercise we are going to use a service from www.synapticdigital.com that outputs a listing of states and abbreviations that we can use in a Flash list component. The service URL is: http://www.synapticdigital.com/webservice/public/regions.asmx.
Go ahead and browse to this page. You will see that the service list 5 methods. The WSDL that we are going to interact with is:
http://www.synapticdigital.com/webservice/public/regions.asmx?WSDL
This service is perfect as it outputs XML in a Flash friendly format. Click on the link for this WSDL and you will see a form that enables you to post data to the service. Enter “USA†into the text field and click Invoke. You will see the following output:
http://www.synapticdigital.com/webservice/public/regions.asmx/listByCountry_lb
Notice that the XML node named list. This node is essentially an array of state names and corresponding abbreviations that we can use in Flash.
Let’s open up Flash MX 2004 and work with this service.
To begin, name layer 1 “actions†and create new layer and name it “componentsâ€.
On the component layer drag an instance of the datagrid component and name it myGrid.
Now select frame one of the actions layer and open the Actions Panel. In the panel, type the following ActionScript. The script is commented so I will not go into describing each step.
Here is the ActionScript code:

The last thing you need to do for our example to work is to import the Web Service Classes into Flash. To do this go to Window >> Other Panels >> Common Libraries >> Classes. There you will see the Web Service classes. Drag an instance onto the stage and delete the instance. The Classes you need are now in the library ready to be called by Flash at runtime.
Your application should resemble the working example here:
I hope that this article de-mystifies Web Services and enables you to utilize this powerful tool in your Flash applications.
Next time I will examine the process of using Flash Remoting to intreact with a remote Web Service. This technique enables you to overcome some of the Flash players security measures relating to retrieving remote data.
Here are a couple of site offering free Web Services:
http://www.flash-db.com/services/
http://www.xmethods.com/