Only have a quick second to throw this out there, but I usually use
the following syntax:

var op:Operation = ws.getOperation("AdminLoginOperation");
var loginObj:Object = new Object();
loginObj.username = "Foo";
loginObj.pwd = "Bar";
op.arguments = loginObj;
op.send();

You'll also want to make sure that your WSDL is loaded before you call
the operation. You can detect this by listening for your WebService
object's "load" event.

HTH,
Ben


--- In [email protected], "rd_grimes" <[EMAIL PROTECTED]> wrote:
>
> 
> I am trying to call a Web Service that uses a document style WSDL. I 
> know the web service works because I am currently consuming it through
> ActionScript 2.0 within Flash 8. But, now, I'm trying to convert over to
> using Flex 2, and this is the one area that is stumping me.
> 
> In ActionScript 2.0, under Flash 8, I have the following:
> 
> 
> class AdminLogin extends mx.screens.Form
> {
> 
>   // Web services variables
>   private var login_ws:mx.services.WebService;
>   private var loginWsCall:mx.services.PendingCall;
>   private var loginWsLog:mx.services.Log;
>   private var loginWSDL_URL:String =
> 'https://myserver.com/AdminLogin.wsdl';
> 
> .
> .
> .
> 
> // Execute when customer clicks the "Login" button
> 
> private function login_btnClick():Void
> 
> {
> 
> 
> 
> 
> login_ws          = new mx.services.WebService(loginWSDL_URL);
> var login:Object  = new Object();
> login.UserID      = userID_ti.text.toString().toUpperCase();
> login.Password    = password_ti.text.toString().toUpperCase();
> loginWsCall       = login_ws.AdminLoginOperation(login);
> 
> // Handle login faults
> loginWsCall.onFault=function(fault:Object):Void { };
> 
> // Handle login results
> loginWsCall.onResult=function(result:Object):Void { };
> 
> 
> 
> 
> .
> 
> .
> 
> .
> 
> 
> Notice the difference between rpc and document style is that the Web
> Service operation is passed an object, rather than a series of
> parameters. I would assume that a similar structure must be used in Flex
> 2, but I'm not getting the proper syntax. I got this far:
> 
> import mx.rpc.events.ResultEvent;
> import mx.rpc.events.FaultEvent;
> 
> // Login user
> public function login(event:flash.events.Event):void
> {
> var login:Object = new Object();
> login.UserID     = userID_txt.text.toUpperCase();
> login.Password   = password_txt.text.toUpperCase();
> var ws:WebService = new WebService('AdminLoginService',
> 'https://myserver.com/AdminLogin.wsdl');
> ws.AdminLoginOperation.addEventListener("result",
> loginResultHandler);
> ws.AdminLoginOperation.addEventListener("fault", loginFaultHandler);
> ws.loadWSDL();
> ws.AdminLoginOperation(login);
> }
> 
> public function loginResultHandler(event:ResultEvent):void {}
> public function loginFaultHandler(event:FaultEvent):void {}
> 
> 
> Any help would be greatly appreciated.
> 
> Ron
>


Reply via email to