- Web Services for the Uninformed
- Building the User Interface
- Using the WebServiceConnector Component
- Binding Data to the Components
Using the WebServiceConnector Component
Macromedia put all the code you'll ever need to connect to a web service into one handy-dandy component called the WebServiceConnector. This gizmo calls up the web service for you, invites it over for dinner, and then beats information out of it until it tells you everything you need to know.
To use/abuse the WebServiceConnector:
In the Components panel in Flash MX Professional 2004, expand the Data Components set.
Drag a WebServiceConnector to the stage (it displays only an icon) and name it dictionaryConnector. Leave the component selected on the stage.
Open the Component Inspector panel (Window > Development Panels > Component Inspector) and click the Parameters tab, shown in Figure 3.
In the WSDLURL field in the Component Inspector, enter the following URL: http://services.aonaware.com/DictService/DictService.asmx?WSDL
In the operation field, click to activate the drop-down menu and choose Define.
Figure 3 Inspecting components is fun and rewarding. Become a licensed Component Inspector today.
Flash has automatically populated the operation menu by reading the WSDL file at the URL you specified for the WSDLURL parameter. There are several operations available via this web service, but for now, we'll focus on simply defining words.
Information about the WSDL we're using in this exercise is available at the Xmethods web site. Xmethods.com lists hundreds of web services you can use for experimentation or real applications. And because Flash parses the WSDL information for you, you don't even have to know how a WSDL file works or how to write one.