[COLOR=#000000][FONT=verdana]I got this function in my program. I linked to the Flex Libraries in my actionscript properties, but when I send info, it returns null. If I get an operation with no parameters, it works fine. What am I doing wrong? I know the problem is most likely in the loginOperation.send().
[/FONT][/COLOR]
stop();
import flash.display.MovieClip;
import flash.events.MouseEvent;
import mx.rpc.soap.*;
import mx.rpc.events.*;
import mx.rpc.AbstractOperation;
import flash.events.Event;
import flash.utils.Timer;
var webService:WebService = new WebService();
var serviceOperation:AbstractOperation;
var loginTimer: Timer = new Timer(1000, 1);
loginTimer.start();
var loginOperation: AbstractOperation;
var nickname: String = "Brian";
var token:String = "token";
var gameName:String = "CRAZ";
loginTimer.addEventListener(TimerEvent.TIMER, SetupWebService);
signin_btn.addEventListener(MouseEvent.CLICK, login);
function SetupWebService(event: TimerEvent):void{
webService.loadWSDL("http://www.askent.com/ttcs.asmx?WSDL");
webService.addEventListener(LoadEvent.LOAD, BuildServiceRequest);
}
function BuildServiceRequest(evt:LoadEvent){
/*loginOperation = webService.getOperation("GuestLogin");
loginOperation.send(nickname, token, gameName);
//nickname = name_input.text;
loginOperation.addEventListener(FaultEvent.FAULT, DisplayError);
loginOperation.addEventListener(ResultEvent.RESULT, DisplayResult);*/
trace("connected");
}
function login(event: MouseEvent): void{
loginOperation = webService.getOperation("GuestLogin");
//nickname = name_input.text;
loginOperation.addEventListener(FaultEvent.FAULT, DisplayError);
loginOperation.addEventListener(ResultEvent.RESULT, DisplayResult);
loginOperation.send(["nickname", "token", "gameName"]);
}
function DisplayError(evt:FaultEvent){
trace("error");
}
function DisplayResult(evt:ResultEvent)
{
var wsdlResponse:String = evt.result as String;
trace(wsdlResponse);
}
function sendLogin(nickname: String, token: String, gameName: String): String{
return nickname + token + gameName;
}
[COLOR=#000000][FONT=verdana]
Most of my code is based off this tutorial here: [/FONT][/COLOR]http://www.kirupa.com/flash/connecting_web_service_pg1.htm and I just modified it to fit my needs.