WebService Class. Asa

xiaoxiao2021-03-06  60

/ / -------------------------------------------------------------------------------------------- ----------------------------------

// WebServiceClass

// - Requires: ResponderClass.as

/ / -------------------------------------------------------------------------------------------- ----------------------------------

// create and copyright help by:

// jesse r. Warden (jesterxl@jesseewarden.com)

// April 23, 2003

/ / -------------------------------------------------------------------------------------------- ----------------------------------

// a Web Service Wrapper Class. Supports listener Via Callmethod,

// or callbacks via callmethodandRespond. can be used with WebServiceQueue.

/ / -------------------------------------------------------------------------------------------- ----------------------------------

// license for use

/ / -------------------------------------------------------------------------------------------- ----------------------------------

// Redistribution and use in source and binary forms, with or welxi,

// Are Permitted Provided That The Following Conditions Are Met:

//

// 1. Redistributions of Source Code Must Retain The Above Copyright Notice, this

// list of conditions and the following disclaim.

//

// 2. Redistributions in Binary Form Must Reproduce The Above Copyright Notice,

// this List of conditions and the folload disclaimer in the documentation

// and / or other matials provided with the distribution.

//

// 3. The name of the author may not be used to endorse or promote products derived

// from this Software Without Specific Prior Written Permission.

//

// this Software Is Provided by The Author `` as '' and any express or ketlied

// Warranties, Including, But Not Limited to, The Implied Warranties of

// Merchantability and Fitness for a particular purpose are disclaimed. In no

// Event Shall The Author Be Liable for ANY Direct, Indirect, Incidental, Special, // ExemPlary, OR Consequential Damages (Including, But Not Limited to, Procurement

// of substeute goods or services; loss of use, data, or facts; or business

// Interruption) However caused and on Any THEORY OF LIABILITY, WHETHER IN

// Contract, Strict Liability, or otherwise, arising

// in Any Way Out of the Use of this Software, Even if Advised of the Possibility

// of such.

/ / -------------------------------------------------------------------------------------------- ----------------------------------

_Global.WebServiceClass = function (GatewayConnection, ServiceURL) {

IF (responderClass == null) {

TRACE ("*** jxl sign: you cannot using WebserviceClass.callmethodanceRespond without responder installed, only callmethod ***");

}

This.init.Apply (this, arguments);

}

WebServiceClass.Prototype.init = function (GatewayConnection, ServiceURL) {

Asbroadcaster.initialize (this);

THIS.GATEWAYCONNECTION = GATEWAYCONNECTION;

This.service = this.gatewayConnection.getService (ServiceURL);

}

WebServiceClass.Prototype.CallMethod = function (MethodName, Arg1, Arg2, Argn) {

arguments.shift ();

Arguments.unshift (this);

This.service [MethodName] .Apply (this.service, arguments);

}

WebServiceClass.Prototype.CallMethodandRespond = function (MethodName,

Callback_obj,

ResultHandler,

Statushandler,

Arg1, arg2, argn) {

// my check for the existance of responderclass

IF (responderClass == null) {

Trace ("*** jxl sign: error ***");

Trace ("WebServiceClass.CallMethodandRespond Will Not Work without Responderclass);

Trace ("if you are going to call this method, make sales"); trace ("************************") ;

}

For (VAR i = 0; i <4; i ) {

arguments.shift ();

}

Var responder = new responderclass (callback_obj, resulthandler, statushandler);

Arguments.unshift (responder);

This.service [MethodName] .Apply (this.service, arguments);

}

WebServiceClass.Prototype.onResult = function () {

Arguments.unshift ("onResult");

This.BroadcastMessage.Apply (this, arguments);

}

WebServiceClass.Prototype.onstatus = function () {

Arguments.unshift ("onstatus");

This.BroadcastMessage.Apply (this, arguments);

}

转载请注明原文地址:https://www.9cbs.com/read-119886.html

New Post(0)