ActionScript 2.0 Components Language Reference |
|
|
|
| WebServiceConnector component > WebServiceConnector.status | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
componentInstance.addEventListener("status",myListenerObject)
Event; broadcast when a call to a web service is initiated, to inform the user of the status of the operation.
The parameter to the event handler is an object with the following fields:
type: the string "status"target: a reference to the object that emitted the event (for example, a WebServiceConnector component)code: a string giving the name of the condition that occurreddata: an object whose contents depend on the codeThe following are the codes and associated data available for the status event:
|
Code |
Data |
Description |
|---|---|---|
|
StatusChange |
{callsInProgress:nnn} |
This event is emitted whenever a web service call starts or finishes. The item nnn gives the number of calls currently in progress. |
|
CallAlreadyInProgress |
No data |
This event is emitted if |
|
InvalidParams |
No data |
This event is emitted if the |
|
WebServiceFault |
{faultcode: code, faultstring: string, detail: detail} |
This event is emitted if other problems occur during the processing of the call. The data is a SOAPFault object. After this event occurs, the attempted call is considered complete, and there is no |
Here are the possible web service faults:
|
faultcode |
faultstring |
detail |
|---|---|---|
|
Timeout |
Timeout while calling method xxx |
|
|
MustUnderstand |
No callback for header xxx |
|
|
Server.Connection |
Unable to connect to endpoint: xxx |
|
|
VersionMismatch |
Request implements version: xxx Response implements version yyy |
|
|
Client.Disconnected |
Could not load WSDL |
Unable to load WSDL, if currently online, please verify the URI and/or format of the WSDL xxx |
|
Server |
Faulty WSDL format |
Definitions must be the first element in a WSDL document |
|
Server.NoServicesInWSDL |
Could not load WSDL |
No elements found in WSDL at xxx |
|
WSDL.UnrecognizedNamespace |
The WSDL parser had no registered document for the namespace xxxx |
|
|
WSDL.UnrecognizedBindingName |
The WSDL parser couldn't find a binding named xxx in namespace yyy |
|
|
WSDL.UnrecognizedPortTypeName |
The WSDL parser couldn't find a portType named xxx in namespace yyy |
|
|
WSDL.UnrecognizedMessageName |
The WSDL parser couldn't find a message named xxx in namespace yyy |
|
|
WSDL.BadElement |
Element xxx not resolvable |
|
|
WSDL.BadType |
Type xxx not resolvable |
|
|
Client.NoSuchMethod |
Couldn't find method 'xxx' in service |
|
|
yyy |
yyy - errors reported from server, this depends on which server you talk to |
|
|
No.WSDLURL.Defined |
The WebServiceConnector component had no WSDL URL defined |
|
|
Unknown.Call.Failure |
WebService invocation failed for unknown reasons |
|
|
Client.Disconnected |
Could not load imported schema |
Unable to load schema; if currently online, please verify the URI and/or format of the schema at (XXXX) |
The following example defines a function fault for the status event and assigns the function to the addEventListener event handler. The example intentionally misspells the URI for the service to return a web service fault (the url should be "http://www.flash-mx.com/mm/tips/tips.cfc?wsdl") and a message asking the user to verify the URI. With a WebServiceConnector component in the library, add the following to the first frame of the timeline:
import mx.data.components.WebServiceConnector;
var fault = function (stat) {
if (stat.code == "WebServiceFault"){
trace(stat.data.faultcode);
trace(stat.data.faultstring);
trace(stat.data.detail);
}
};
var wsConn:WebServiceConnector = new WebServiceConnector();
wsConn.addEventListener("status", fault);
wsConn.WSDLURL = "http://www.flasht-mx.com/mm/tips/tips.cfc?wsdl";
wsConn.operation = "getTipByProduct";
wsConn.params = ["Flash"];
wsConn.trigger();
|
|
|
|