WebServiceConnector.trigger()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX Professional 2004.

Usage

componentInstance.trigger();

Description

Method; initiates a call to a web service. Each web service defines exactly what this involves. If the operation is successful, the results of the operation appear in the results property for the web service.

The trigger() method performs the following steps:

  1. If any data is bound to the params property, the method executes all the bindings to ensure that up-to-date data is available. This also causes data validation to occur.
  2. If the data is not valid and suppressInvalidCalls is set to true, the operation is discontinued.
  3. If the operation continues, the send event is emitted.
  4. The actual remote call is initiated using the connection method indicated (for example, HTTP).

Example

This example returns data from a remote web service and traces a tip. Drag a WebServiceConnector component into your library, and enter the following code on Frame 1 of the timeline:

import mx.data.components.WebServiceConnector;
var res:Function = function (evt:Object) {
    trace(evt.target.results);
};
var wsConn:WebServiceConnector = new WebServiceConnector();
wsConn.addEventListener("result", res);
wsConn.WSDLURL = "http://www.flash-mx.com/mm/tips/tips.cfc?wsdl";
wsConn.operation = "getTipByProduct";
wsConn.params = ["Flash"];
wsConn.suppressInvalidCalls = true;
wsConn.trigger();