Wow, well done! Thanks for the reply, I will need to read it a few times to try and mimic your approach, but all this information is most appreciated.
Quite a shame that Macromedia doesn't support WS calls through actionscript though... --- In flexcoders@yahoogroups.com, Jeff Tapper <[EMAIL PROTECTED]> wrote: > Officially, I don't believe it is supported to call a WebService directly > from an AS class, without first having an instance of the > WebServiceConnector in an mxml file within the application. That said, I > have seen it done... > > > Try something like this: > > class custom.DataService extends mx.core.UIObject{ > > var remoteDataService:mx.servicetags.Service; > > function DataService() { > > } > > function init():Void{ > super.init(); > var props = new Object(); > applyProperties(props, props); > _custom_DataService_webServiceSetup(); > } > > function _custom_DataService_webServiceSetup():Void { > remoteDataService = new mx.servicetags.Service(this._url, > "http://localhost:8500/mmcourses/faad2004/dbs/Bikeparts.cfc?wsdl", new > mx.services.Log(1, "WebService"), null, this, null, null, null, null, false); > remoteDataService.__name = "remoteDataService"; > remoteDataService.__faultHandler = function(event) { > faultHandler(event) > } > remoteDataService.__resultHandler = function(event) > { > resultHandler(event) > } > remoteDataService.__showBusyCursor = true; > } > function resultHandler(event){ > // do something > } > function faultHandler(event){ > // do something > } > } > > > I created this by turning on "keep-generated-as" in the flex config file, > and then ran an app with a WebService in it. The generated AS for that > mxml file will contain all the correct code to instantiate and use the service. > > I had a DataService.mxml file which looks like this: > > <s:ProxyFactory xmlns:mx="http://www.macromedia.com/2003/mxml" > xmlns:s="fast.services.*"> > > <mx:WebService id="remoteDataService" > wsdl="http://localhost:8500/mmcourses/faad2004/dbs/Bikeparts.cfc?wsdl" > result="resultHandler(event)" fault="faultHandler(event)" > showBusyCursor="true" useProxy="false"/> > </s:ProxyFactory> > > Which generated this AS: > > // C:\Program > Files\Macromedia\Flex15\jrun4\servers\default\flex\MAX05\start\custom\DataService-generated.as > class custom.DataService extends fast.services.ProxyFactory > { > var remoteDataService:mx.servicetags.Service; > > function DataService() > { > > } > > function init():Void > { > > super.init(); > > var props = new Object(); > applyProperties(props, props); > > > _custom_DataService_webServiceSetup(); > > } > > // Event handler functions... > function _custom_DataService_webServiceSetup():Void > { > remoteDataService = new mx.servicetags.Service(this._url, > "http://localhost:8500/mmcourses/faad2004/dbs/Bikeparts.cfc?wsdl", new > mx.services.Log(1, "WebService"), null, this, null, null, null, null, false); > remoteDataService.__name = "remoteDataService"; > remoteDataService.__faultHandler = function(event) { > faultHandler(event) > } > remoteDataService.__resultHandler = function(event) > { > resultHandler(event) > } > remoteDataService.__showBusyCursor = true; > } > > > } > > Once you have the genreated AS, you can rename it as DataService.as, and > rename the DataService.mxml to something else. So long as the > DataService.as file is in the same directory, it will continue to run > without issue. My example uses the Macromedia FAST Toolkit for the Data > Services, but that is not a requirement for making this work. > > > > > > > At 02:44 PM 8/26/2005, inajamaica wrote: > >All, > > > >I have been up & down the flex documentation and the web (& searched > >through alot of this forum), but I can't seem to find a concrete > >example of calling a webservice and using the WebService object SOLELY > >with ActionScript. > > > >I have the following so far: > > > >//supposedly, this parses the wsdl so that... > >var ws = new WebService (wsdlLocation); > >ws.setEndpointURI > >("<http://somewhere.com/endpoint>http://somewhere.com/endpoint"); > >//...I can just do this: > >result = ws.anOperationDefinedInTheWSDL (parameter); > > > >But I know I'm missing something here...anyone have experience here? > >For the insane cost of Flex, it's hard to believe that I can't find > >ALL this info @ Macromedia's website. > > > >Thanks.. > > > > > > > > > >-- > >Flexcoders Mailing List > >FAQ: > ><http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt>http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > >Search Archives: > ><http://www.mail-archive.com/flexcoders%40yahoogroups.com>http://www.mail-archive.com/flexcoders%40yahoogroups.com > > > > > > > > > >SPONSORED LINKS > ><http://groups.yahoo.com/gads?t=ms&k=Computer+software+testing&w1=Computer+software+testing&w2=Macromedia+flex&w3=Development&w4=Software+developer&c=4&s=93&.sig=kh2CguJwmatU5oBXjFo9Rg>Computer > >software testing > ><http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Computer+software+testing&w2=Macromedia+flex&w3=Development&w4=Software+developer&c=4&s=93&.sig=dAUcEV7do91-wrRtVS641g>Macromedia > >flex > ><http://groups.yahoo.com/gads?t=ms&k=Development&w1=Computer+software+testing&w2=Macromedia+flex&w3=Development&w4=Software+developer&c=4&s=93&.sig=AlxNUQBOI7Io7S7nhmxV0Q>Development > > > ><http://groups.yahoo.com/gads?t=ms&k=Software+developer&w1=Computer+software+testing&w2=Macromedia+flex&w3=Development&w4=Software+developer&c=4&s=93&.sig=QWIit8JayomoIHLVkV3FDg>Software > >developer > > > > > >---------- > >YAHOO! GROUPS LINKS > > > > * Visit your group > > "<http://groups.yahoo.com/group/flexcoders>flexcoders" on the web. > > * > > * To unsubscribe from this group, send an email to: > > * > > <mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED] > > > > * > > * Your use of Yahoo! Groups is subject to the > > <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service. > > > > > >---------- ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/