View Full Version : AS3 and web services

11-08-2006, 06:27 PM
I'm converting an AS2 Flash 8 project to AS3 Flash 9 and I'm running into problems converting my web service consumer.

When I compile in Flash 9 I get this error

[Compiler] Error #1046: Type was not found or was not a compile-time constant: WebService

My Code works perfect if stripped out and exported as AS2. Does anybody have a working example of consuming a simple webservice in AS3?



11-08-2006, 08:03 PM
Hey Chris, dunno if this will help, maybe you looked it up already but this is what the docs say abou that error.

The class used as a type declaration is either unknown or is an expression that could have different values at run time. Check that you are importing the correct class and that its package location has not changed. Also, check that the package that contains the code (not the imported class) is defined correctly (for example, make sure to use proper ActionScript 3.0 package syntax, and not ActionScript 2.0 syntax).

The error can also occur if the class being referenced is not defined in a namespace that is in use or is not defined as public:

public class Foo{}If you are using Flex™ Builder™ 2 and the class is in a library, make sure to set the class path for the project.

It does mention something about AS2 vs AS3. And maybe a small test example might help to clear some things up.


11-10-2006, 02:21 AM
I got an email from Joey Lott the author of the AS3 Cookbook. Basically he said that in Flash 9 AS3 there is no built in web services. The only way you can do it is manually assemble and de-assemble SOAP request. Ouch.

Oh well.

11-10-2006, 07:59 AM
The author of this AS3 Cookbook *holds it up* LOL That's odd cuz in his book he even mentions mx.rpc.soap.WebService. Or maye he/you meant that it's not "high level" but LOL Soapy. If you got it figured out then that's great.

11-10-2006, 10:44 AM
the mx package is reserved for Flex.

09-23-2007, 07:39 PM
Does anybody have a working example of consuming a simple webservice in AS3?


There's a sample code WebService in AS3 at the Kirupa's forum (http://www.kirupa.com/forum/archive/index.php/t-259327.html), hope this will help to someone.