WebServices in Flash AS2

import mx.services.*;

// define your web service URL, remember to have WDSL at the end

var webService= “http://services.aonaware.com/DictService/DictService.asmx?WSDL”;

var webService = new mx.services.WebService(webService);
var serviceStatus = true;
webService.onLoad = function (result)
{
trace(“Accessing Web Service: ” + result.toString());
}
;

// to access a method in the web service

function loadWebMethod() {

var value1:String = ‘test value’;

var value2:Number = 100;

// set object to use web method called ‘MyWebMethod’

serviceObj = webService.MyWebMethod(value1,value2);

serviceObj .onStatus = function(status) {
trace(status);
};

serviceObj .onResult = function(result) {
// Load Current Server Time
trace(result.toString());
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.parseXML(result.toString());
ServerTime.Year = xml.firstChild.attributes.year;
};

serviceObj .onFault = function(fault) {
trace(“Failed to Load WebService”+fault.faultCode+”,”+fault.faultstring);
};
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s