WebServices and AS3
Copy link to clipboard
Copied
I am new to Flash and am looking for a RIA technology. One of the key things I am looking for direct interaction with Web Services that are on the domain as the RIA code. In other words, I don't want to have any server side code between the RIA and the Web Services.
I was looking on Flash Development Center and all the Web services examples where for Flash Professional 8 and earlier. Can Flash CS4 interact with a Web Service that is hosted on the same domain as the Flash CS4 movie?
If Flash CS4 cannot, what about Flex? I would prefer Flash, because I own it and I would prefer not to have to justify yet another development environment to my boss.
Sam
Copy link to clipboard
Copied
Sure it can, there are some restrictions due to the security sandbox that
Flash Player has, but you can read about this and how to overcome those
restrictions in the Flash Security Center
http://www.adobe.com/products/flashplayer/security/
Copy link to clipboard
Copied
Michael,
Actually, I think I have the security stuff figured out:
Lets say the flash movie is http://www.myDomain.com/TheMovie.swf, than all the Web Services also need to be on http://www.myDomain.com somewhere. Seems pretty straight forward.
What I cannot find is any instructions/tutorials/examples of how to make TheMovie.swf call into a web service on the same domain. Might you know where I can find one?
Copy link to clipboard
Copied
Cool, you could use an script to detect to local domain at runtime, read
this:
http://renaun.com/blog/2008/10/16/264/
Copy link to clipboard
Copied
So this is to say that there is no functionality built into Flash CS4 that can read a WSDL and create some nicely wrapped functions to call in AS3, you have to do it all by hand, correct?
Copy link to clipboard
Copied
Not sure what you mean, but this function will detect the domain at runtime
and then you will not to hard code the full url. Although you could use an
xml to act as a config file, there are several approaches to this.
Copy link to clipboard
Copied
What do I mean? Well the concept of a Web service is a transport mechanism between two different "systems". Web Services are all based on the Web Services Description Language or WSDL. WSDL is a xml based language that provides a model for describing Web services. In other words, WSDL describes the operations that a Web service implements. Please see Wikipedia for details on WSDL.
One of the transport mechanism for Web services is XML, Simple Object Access Protocol or SOAP to be specific. In the other languages I use (.Net and standard C) there are tools that will read the WSDL and create classes and/or functions to that wrap all the plumbing. I know there are Java and C++ tools to create all this wrapper code from the WSDL file, too.
The question is: Is there a way for Flash CS4 to consume a WSDL file and generate "classes" so that I don't have to deal with the raw SOAP XML.
Sam
Copy link to clipboard
Copied
Flex has those capabilities.
Copy link to clipboard
Copied
But does Flash CS4 have that ability or is it ONLY Flex 3.0? Also, where might I find an example of Flex 3.0 that used WSDL?
Copy link to clipboard
Copied
I don't know much about the Flash Authoring tool, the only thing I know for
sure is that kind of feature is outside the scope of the tool. You can
download the Flex Builder Trial and play with it or go to Flex 3 LiveDocs
there you can find all the info that you need.
Copy link to clipboard
Copied
Out of the box, Flash AS3 has no Webservice support.
There are "WebService components" for AS2, but they dropped them for AS3.
Flex does have a WebService API and there's a few tricks to use those in Flash.
// the hard way
http://labs.wichers.nu/2007/12/25/using-flex-compiled-code-within-flash/
// easy way
http://flashauthoring.blogspot.com/2008/10/using-flex-webservice-component-in.html

