Ok, my 1046 error was from a typo, duh... ASyncToken should have been AsyncToken
--- In flexcoders@yahoogroups.com, "phipzkillah" <[EMAIL PROTECTED]> wrote: > > Ben, > > What is the best way to go about handling the result from the > operations.send() call. I'm sure you must have to add an event > listener on the operations call. > > I do not fully understand the Iresponder from your initial posting. > > << > You can optionally capture the token created by the call and assign a > responder as well: > > var call:ASyncToken = op.send(); > call.addResponder(IResponder); > The IResponder interface defines a result and fault method that are > called when the operation returns. >> > > I tried to add that into my code and received the error: > > 1046: Type was not found or was not a compile-time constant: ASyncToken. > > I believe I have all the proper classes imported: > > import mx.rpc.soap.WebService; > import mx.rpc.soap.WSDL; > import mx.rpc.soap.*; > import mx.rpc.IResponder; > import mx.rpc.*; > import mx.rpc.events.ResultEvent; > import mx.rpc.AsyncToken; > > Now even if I get the error eliminated, how do you add a resultHandler > function to capture the xml returned from the operations call? > > Maybe you can briefly explain how the AsyncToken and Iresponder work? > > Here is my current snippet of code: > private function init():void{ > var ws:WebService = new WebService; > ws.wsdl = > "http://www.myservice.com/services/InventoryService?wsdl"; > ws.useProxy = false; > ws.loadWSDL("http://www.myservice.com/services/InventoryService?wsdl"); > > var op:Operation = ws.getOperation("getPhones") as > Operation; > op.arguments.projectId = 1; > op.resultFormat= "e4x"; > > //var call:ASyncToken = op.send(); //1046 error > //call.addResponder(IResponder); > > op.send(); > } > > Thanks for all your help to far. It has definitely helped!! > > --Phil > > --- In flexcoders@yahoogroups.com, "ben.clinkinbeard" > <ben.clinkinbeard@> wrote: > > > > > is that the method we are trying to call through the web service? > > Yep. > > > > You know, I almost included the bit about e4x the first time but > > decided against it. For that you simply do op.resultFormat = "e4x"; > > > > Flex handles the serialization of your objects for you, so you just > > put the arguments your method requires onto the arguments property. So > > if your remote method's signature is: doCoolStuff(name:String, > > age:Number, hobbies:Array), you would use the following code in Flex: > > > > op.arguments.name = "Bob Cratchett"; > > op.arguments.age = 34; > > op.arguments.hobbies = new Array("working", "playing with Tim", "etc"); > > > > HTH, let me know if you have additional questions. > > Ben > > > > > > --- In flexcoders@yahoogroups.com, "phipzkillah" <pkrasko@> wrote: > > > > > > Thanks for your reply Ben. > > > > > > I have a few more questions, hopefully you can help. The > > > "doCoolStuff", is that the method we are trying to call through the > > > web service? From your example it seems like you can specify > > > operation arguments in either an object or array format. I don't > > > think I fully understand how the web service works interprets that... > > > > > > If a method requires certain parameters (ie: name:String, age:Number) > > > how would you go about passing those in as arguments?? > > > > > > op.arguments.objectArg = {name: "John Doe", age: 26} ?? > > > > > > How do you specify the result format to be e4x? > > > > > > Help would be appreciated. > > > > > > -phil > > > > > > > > > --- In flexcoders@yahoogroups.com, "ben.clinkinbeard" > > > <ben.clinkinbeard@> wrote: > > > > > > > > I've not dealt with authentication but here is how to call an > > operation. > > > > > > > > // getOperation() returns generic AbstractOperation by default > > > > // you want mx.rpc.Operation, not mx.rpc.mxml.Operation > > > > var op:Operation = ws.getOperation("doCoolStuff") as Operation; > > > > op.arguments.arrayArg = new Array("foo", "bar"); > > > > op.arguments.objectArg = {propA: "tweedle", propB: "dee"}; > > > > op.send(); > > > > > > > > You can optionally capture the token created by the call and > assign a > > > > responder as well: > > > > > > > > var call:ASyncToken = op.send(); > > > > call.addResponder(IResponder); > > > > > > > > The IResponder interface defines a result and fault method that are > > > > called when the operation returns. > > > > > > > > HTH, > > > > Ben > > > > > > > > > > > > > > > > --- In flexcoders@yahoogroups.com, "phipzkillah" <pkrasko@> wrote: > > > > > > > > > > Hi, > > > > > > > > > > I am trying to create a web service in pure action script. I > > need to > > > > > authenticate and then call the proper method from the web service. > > > > > > > > > > I have not seen any good tutorials explaining how to do this... > > > > > > > > > > This is my current snippet: > > > > > > > > > > private function init():void{ > > > > > > > > > > var ws:WebService = new WebService; > > > > > > > > > > ws.wsdl = > > > > > "http://sc-vmx-03/clarusipc/services/InventoryService?wsdl"; > > > > > ws.useProxy = false; > > > > > > > > > > > > > > > > > > > > > > > > > ws.loadWSDL("http://sc-vmx-03/clarusipc/services/InventoryService?wsdl"); > > > > > > > > > > } > > > > > > > > > > What is the format to add in an operations object that will > include > > > > > the method and parameters that I'm going to call? > > > > > > > > > > How would I go about editing the http request to include a > username > > > > > and password to authenticate against? > > > > > > > > > > Any help would be greatly appreciated!!! It's driving me nuts! > > > > > > > > > > > > > > >