>>>For small projects using the WebServices panel is handy. For
>>>larger projects you probably should be using a framework
>>>(ARP/Cairngorn) in which case everything is written in code.
>
> Nah, I've been using Webservices in Flash for over a year now on large
> RIA projects, and you certainly don't need a framework to do it.  Sorry,
> I know those frameworks can be great, but they take an advanced coder to
> learn how to use an implement.
>

Well, I guess it depends on what you call a large project ;-)
I do know that without a proper framework (MVC at a mimimum, doesn't have to be 
ARP etc..) things get messy, fast..
And I disagree that you have to be an advanced coder to learn and understand 
them and afterall, this is FlashCoders, not 
FlashNewbies.

That aside, I didn't say that if you want to use WebServices through 
ActionScript that you need some kind of framework.

--> Small Projects: WebService panel = handy
--> Larger Projects: WebServices through code

>
> For example, off the top of my head, say with your SOAP webservice, you
> are sending an array of fruit objects:
>
> import mx.services.*
> import mx.util.Delegate
>
> var myWS:WebService = new WebService("http://myWebService.asmx?WSDL";);
> myWS.onLoad = Delegate.create(this, callMyWSmethod)
>
> function callMyWSmethod()
> {
>    var myGetResult:Object = new Object();
>    myGetResult = myWS.getMyData();
>    myGetResult = Delegate.create(this, myGetResultMethod)
> }
>
> function myGetResultMethod(result:Object)
> {
>  trace(result.fruit[7].name)  //traces "apple"
>  trace(result.fruit[7].quantity)  //traces "45"
> }
>

import mx.services.*;
import mx.util.Delegate;

 function myWSLoadHandler() {
    // call to webservice method returns a PendingCall
    var myData_pc:PendingCall = myWS.getMyData();
    myData_pc.onResult = Delegate.create(this, myDataResultHandler);
}

 function myDataResultHandler(result:Object) {
  trace(result.fruit[7].name);
  trace(result.fruit[7].quantity);
}

var myWS:WebService = new WebService("http://myWebService.asmx?WSDL";);
myWS.onLoad = Delegate.create(this, myWSLoadHandler);
 


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to