User Guide

WebServiceConnector component (Flash Professional only) 869
Example
This example returns data from a remote web service and traces a tip and how long the service
takes to return the data to the SWF file. Drag a WebServiceConnector component into your
library, and enter the following code on Frame 1 of the Timeline:
import mx.data.components.WebServiceConnector;
var startTime:Number;
var wscListener:Object = new Object();
wscListener.result = function(evt:Object) {
var resultTimeMS:Number = getTimer()-startTime;
trace("result loaded in "+resultTimeMS+" ms.");
trace(evt.target.results);
};
wscListener.send = function(evt:Object) {
startTime = getTimer();
};
var wsConn:WebServiceConnector = new WebServiceConnector();
wsConn.addEventListener("result", wscListener);
wsConn.addEventListener("send", wscListener);
wsConn.WSDLURL = "http://www.flash-mx.com/mm/tips/tips.cfc?wsdl";
wsConn.operation = "getTipByProduct";
wsConn.params = ["Flash"];
wsConn.suppressInvalidCalls = true;
wsConn.multipleSimultaneousAllowed = false;
wsConn.trigger();
WebServiceConnector.params
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX Professional 2004.
Usage
componentInstance.params
Description
Property; specifies data that will be sent to the server when the next trigger() operation is
executed. The data type is determined by the WSDL description of the web service.
When you call web service methods, the data type of the
params property must be an
ActionScript object or array as follows:
If the web service is in document format, the data type of params is an XML document.
If you use the Property inspector or Component inspector to set the WSDL URL and
operation while authoring, you can provide
params as an array of parameters in the same order
as required by the web service method, such as
[1, "hello", 2432].