Glad you got it working. You should check out E4X, its the shiz. Will let you change your xml parsing code to something like this:
var x:XML = new XML(event.message); var sessionID:String = x..SessionID; var auth:Boolean = (x..Authorized == "Y"); // the attribute version var auth:Boolean = ([EMAIL PROTECTED] == "Y"); HTH, Ben --- In [email protected], "rd_grimes" <[EMAIL PROTECTED]> wrote: > > > Thanks Ben for responding to my inquiry. > > I spent some more time trying to get this right and got it working and > here's what I can document for fellow consumers of Web Services via Flex > 2. The following consumes web services that use document style wsdl's, > and without using FDS. > > > > import mx.rpc.soap.WebService; > import mx.rpc.events.ResultEvent; > import mx.rpc.events.FaultEvent; > > public var sessionID:String = new String(''); > public var authorized:Boolean = new Boolean(false); > > // Login user > public function login(event:flash.events.Event):void > { > // create login object with userID and Password > // properties to be passed to the web service > var login:Object = new Object(); > login.UserID = userID_txt.text.toUpperCase(); > login.Password = password_txt.text.toUpperCase(); > > // set up web service > var ws:WebService = new mx.rpc.soap.WebService(); > ws.useProxy = false; > ws.LoginOperation.addEventListener("result", loginResultHandler); > ws.addEventListener("fault", loginFaultHandler); > ws.loadWSDL('https://secure.mydomain.com/Login.wsdl'); > ws.LoginOperation(login); > } > > public function loginResultHandler(event:ResultEvent):void > { > var xmlDoc:XML = new XML(event.message.body); > var loginList:XMLList = new XMLList(); > loginList = xmlDoc.children().children().children(); > sessionID = loginList.children()[0].toString(); > authorized = (loginList.children()[2].toString() == 'Y') ? true : > false; > Alert.show('Session: ' + sessionID + '\nauthorized: ' + authorized); > } > > public function loginFaultHandler(event:FaultEvent):void > { > Alert.show('Fault: ' + event.fault.faultString.toString()); > } > > > The principal difference between rpc and document type wsdl's is that a > document type wsdl requires you to invoke the operation by passing to it > an object with the parameters as object properties. With an RPC type > wsdl, you would typically pass the operation a set of parameters. In > other words, instead of > > ws.LoginOperation(login); > > you would have > > ws.LoginOperation(UserID, Password); > > > Also, I should note that, in this particular case, I am receiving back > an xml structure like this, enclosed within a SOAP envelope: > > <login> > <SessionID>123123456</SessionID> > <Message>Some message goes here</Message> > <Authorized>Y</Authorized> > </login> > > > Obviously, if I had programmed the web service to return this: > > > <login> > <User SessionID="123123456" Message="Some message goes here" > Authorized="Y" /> > </login> > > > Then, the code would be slightly different to process it > > > import mx.rpc.soap.WebService; > import mx.rpc.events.ResultEvent; > import mx.rpc.events.FaultEvent; > > public var sessionID:String = new String(''); > public var authorized:Boolean = new Boolean(false); > > // Login user > public function login(event:flash.events.Event):void > { > // create login object with userID and Password > // properties to be passed to the web service > var login:Object = new Object(); > login.UserID = userID_txt.text.toUpperCase(); > login.Password = password_txt.text.toUpperCase(); > > // set up web service > var ws:WebService = new mx.rpc.soap.WebService(); > ws.useProxy = false; > ws.LoginOperation.addEventListener("result", loginResultHandler); > ws.addEventListener("fault", loginFaultHandler); > ws.loadWSDL('https://secure.mydomain.com/Login.wsdl'); > ws.LoginOperation(login); > } > > public function loginResultHandler(event:ResultEvent):void > { > var xmlDoc:XML = new XML(event.message.body); > var loginList:XMLList = new XMLList(); > loginList = xmlDoc.children().children().children(); > sessionID = loginList.attribute('SessionID').toString(); > authorized = (loginList.attribute('Authorized').toString() == 'Y') ? > true : false; > Alert.show('Session: ' + sessionID + '\nauthorized: ' + authorized); > } > > public function loginFaultHandler(event:FaultEvent):void > { > Alert.show('Fault: ' + event.fault.faultString.toString()); > } > > Hope this makes sense. Also, if anyone sees anyway to further steamline > this code so that it is more efficient, please let me know. > > Ron >

