0 Replies Latest reply on Oct 23, 2012 11:54 AM by Thabtinator

    Web Service Operation returns null values

    Thabtinator

      I got a Flash program that uses a Web Service.  I linked the actionscript to the Flex Files to get my connection to work.  I got it to work fine, but the problem is with sending it parameters.  This only works on functions without parameters.  But when I try to pass parameters, it returns null.  I also tried using the argruments function, but that caused it to return error.  What do I do to make it work?  Here is my code below:

       

       

      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(); 
      webService.wsdl = "http://www.askent.com/ttcs.asmx?WSDL";
      webService.loadWSDL();
      var serviceOperation:AbstractOperation;
      /*var loginTimer: Timer = new Timer(1000, 1);
      loginTimer.start();*/
      var loginOperation: AbstractOperation;
      
      
      var nickname:String;
      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({Nickname: nickname, Token: token, GameName: gameName});
                //loginOperation.arguments = {nickname: "GGG", Token: "token", GameName: "gameName"};
                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;
      }