All data service calls are asynchronous.  This means you cannot access the return value in the same function in which you invoke the call.

 

You must use binding or a handler function called by the result event.

 

The data service calls return an AsyncToken object, which can be used to keep track of what result goes with what call.  It is part of the ACT, Asynchronous Call Token pattern. 

 

Look a little further, post back if you still have troubles.

 

Tracy

 


From: [email protected] [mailto:[email protected]] On Behalf Of Nehal Gandhi
Sent: Monday, May 29, 2006 8:05 AM
To: [email protected]
Subject: [flexcoders] how to call webservice method in flex2.0

 

hi,
i have created simple webservice in C#. it works fine from IIS. how do i call from Flex2.0?

"SayHello" method return string but i get output "[object AsyncToken]"

i tried following but its not working. i cant figure out what is missing here?


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:WebService id="wsBlogAggr"  wsdl="http://localhost/MyWebServices/FirstService.asmx?wsdl" invoke="mx.controls.Alert.show ('invoke')"
    useProxy="false" >
</mx:WebService>
<mx:Script>
    <![CDATA[
        function readWS():void{
            //mx.controls.Alert.show("called fn");
            var p=wsBlogAggr.SayHello();           
            mx.controls.Alert.show(p);           
        }
       
    ]]>
</mx:Script>
<mx:VBox>
    <mx:Button id="callWS" click="readWS()" label="Click to read" />   
    <mx:TextArea id="retVal" width="300" htmlText="true" borderColor="0xff0000" />
</mx:VBox>
</mx:Application>

Thanks
Neh



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to