Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > Web service classes > WebService class | |||
ActionScript Class Name mx.services.WebService
The WebService class is part of the mx.services package and is used with the Log, PendingCall, and SOAPCall classes. For an overview of the classes in the mx.services package, see Web service classes.
|
NOTE |
|
The WebService class is supported only if you are working in a document that specifies ActionScript 2.0 in its Publish Settings. |
The WebService class is not the same as the WebServiceConnector class. The WebServiceConnector class provides an ActionScript interface to the visual WebServiceConnector component.
The WebService object acts as a local reference to a remote web service. When you create a new WebService object, the WSDL file that defines the web service gets downloaded, parsed, and placed in the object. You can then call the methods of the web service directly on the WebService object and handle any callbacks from the web service. When the WSDL has been successfully processed and the WebService object is ready, the WebService.onLoad callback is invoked. If there is a problem loading the WSDL, the WebService.onFault callback is invoked.
When you call a method on a WebService object, the return value is a callback object. The object type of the callback returned from all web service methods is PendingCall. These objects are normally not constructed by you, but instead are constructed automatically as a result of the webServiceObject.webServiceMethodName() method that was called. These objects are not the result of the WebService call, which occurs later. Instead, the PendingCall object represents the call in progress. When the WebService operation finishes executing (usually several seconds after a method is called), the various PendingCall data fields are filled in, and the PendingCall.onResult or PendingCall.onFault callback you provide is called. For more information about the PendingCall object, see PendingCall class.
Flash Player queues any calls you make before the WSDL is parsed, and attempts to execute them after parsing the WSDL. This is because the WSDL contains information that is necessary for correctly encoding and sending a SOAP request. Function calls that you make after the WSDL has been parsed do not need to be queued; they are executed immediately. If a queued call doesn't match the name of any of the operations defined in the WSDL, Flash Player returns a fault to the callback object you were given when you originally made the call.
The WebServices API, included under the mx.services package, consists of the WebService class, the Log class, the PendingCall class, and the PendingCall class.
To make the web service classes available at runtime, you must have the WebServiceConnector component in your FLA file's library. If you're using ActionScript only to access a web service at runtime, you must add this component manually to your document's library.
The following table lists methods of the WebService object.
|
Method |
Description |
|---|---|
|
Gets the SOAPCall object for a given operation. |
|
|
Invokes a specific web service operation defined by the WSDL. |
The following table lists the callbacks of the WebService object.
|
Callback |
Description |
|---|---|
|
Called when an error occurs during WSDL parsing. |
|
|
Called when the web service has successfully loaded and parsed its WSDL file. |
Flash CS3
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00003723.html
Comments
dezza said on Aug 1, 2007 at 3:25 AM : AS3dev said on Dec 14, 2007 at 8:29 AM : Jason@Disney said on Oct 20, 2008 at 8:51 PM :