The code looks fine.Are you getting any errors? On Tue, Dec 2, 2008 at 10:47 AM, punit <[EMAIL PROTECTED]> wrote:
> > hi guys, > i am invoking a webservice using mxml in the following way.. > > > <mx:WebService > id="userRequest" > wsdl="http://146.223.151.79:9081/Beta/services/NewMessage/ > wsdl/NewMessage.wsdl<http://146.223.151.79:9081/Beta/services/NewMessage/wsdl/NewMessage.wsdl> > "> > <mx:operation name="Xmlforu1" resultFormat="e4x" > fault="mx.controls.Alert.show(event.fault.faultString)" > result="handle(event);"/> > </mx:WebService> > > the handle() function is written within the Script tag of the mxml and > it works fine... > > i want to modularize the code now..so i want to write a AS class (say > MyWebService) that will invoke the service... > 'i tried the following code... > > > > package components > { > import mx.controls.Alert; > import mx.rpc.events.FaultEvent; > import mx.rpc.events.ResultEvent; > import mx.rpc.soap.mxml.Operation; > import mx.rpc.soap.mxml.WebService; > import mx.utils.ObjectUtil; > import mx.rpc.AsyncToken; > public class CRMWebService > { > public function CRMWebService() > { > var service:WebService = > new WebService(); > service.loadWSDL(" > http://146.223.151.79:9081/Beta/services/ > NewMessage/wsdl/NewMessage.wsdl<http://146.223.151.79:9081/Beta/services/NewMessage/wsdl/NewMessage.wsdl> > "); > var op:Operation = new Operation(service,"Xmlforu1"); > op.addEventListener(ResultEvent.RESULT,handle); > op.addEventListener(FaultEvent.FAULT,fault); > op.resultFormat="e4x"; > op.send(); > Alert.show("sent"); > var token1:AsyncToken= service.Xmlforu1("one"); > token1.addEventListener(ResultEvent.RESULT,handle); > token1.addEventListener(FaultEvent.FAULT,fault); > } > > > public function fault(event:FaultEvent):void{ > Alert.show(event.fault.faultString); > } > > public function handle(event:ResultEvent):void{ > Alert.show("success"); > var SERlist:String = ObjectUtil.toString > (event.result.Xmlforu1Return); > var data:Object = new Object(); > var xml:XML = new XML(SERlist); > data =xml; > > > } > } > } > > its not working....an suggents... > > thanks... > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

