Flash Player has no built-in support for SOAP web services. However, Flex provides a
WebService component that uses built-in HTTP request/response support as well as XML support to enable you to work with SOAP-based web services. There are two ways you can work with the
WebService components: using MXML and using ActionScript.
You can create a
WebService component instance using MXML. When you do, you should specify an
id and a value for the
wsdl property, as in the following example:
<mx:WebService id="statesService" wsdl="http://www.rightactionscript.com/states/webservice/StatesService.php?wsdl" />
Web services define one or more methods or operations. You must define the
WebService instance so that it knows about the operations using nested operation tags. The operation tag requires that you specify the name at a minimum. The following example defines an operation called
getCountries. This means that the WSDL document must also define a
<mx:WebService id="statesService" wsdl="http://www.rightactionscript.com/states/webservice/StatesService.php?wsdl"> <mx:operation name="getCountries" /> </mx:WebService>
Once you've defined the
WebService instance and an operation, you need to be able to call the method and handle the response, which we'll look at in the next few sections.
All operations that you define for a
WebService component instance are accessible as properties of the instance. ...