Arp 3 Preview Release
I've committed the first working version of Arp with AS3 and Flex 2 support into the Arp SVN repository.
You can check out just the AS3 version of the framework from: http://svn1.cvsdude.com/osflash/arp/trunk/as3/
See just the code for the Flex 2 version of the PizzaService sample application here: http://svn1.cvsdude.com/osflash/arp/trunk/samples/PizzaService/client/flex2/
(You can use Import... -> Existing Projects into Workspace to import both of those into your Flex Builder 2 workspace.)
The current Flex 2 version of the PizzaService sample application is a port of the Flex 1.5 version. While migrating it, I found that there wasn't support in Flex 2 for migrating applications that use AMF0 remoting (i.e., those built in Flex 1.5 and lower that use Flash Remoting). Instead of using the
The PizzaService application in Flex 1.5 defines a service in the ServiceLocator as shown below:
var pizzaService:Service = new Service ( gatewayURL, null, "PizzaService", null, null );In Flex 2, the call is slightly different and you use the new AMF0Service class in Arp 3:
var pizzaService:AMF0Service = new AMF0Service ( gatewayURL, "PizzaService", null );Similarly, in Flex 1.5 you call a server-side method through Remoting as shown below:
var pizzaService:AMF0Service = ServiceLocator.getInstance().getService ( "pizzaService" ); var pendingCall:AMF0PendingCall = pizzaService.order( orderVO ); pendingCall.responder = new AMF0RelayResponder(this, "onResult", "onStatus");
To do the same thing in Flex 2 is as easy as replacing the Service, PendingCall and RelayResponder classes with the new migration classes provided in Arp 3 -- AMF0Service, AMF0PendingCall and AMF0RelayResponder -- as shown below:
var pizzaService:AMF0Service = ServiceLocator.getInstance().getService ( "pizzaService" ); var pendingCall:AMF0PendingCall = pizzaService.order( orderVO ); pendingCall.responder = new AMF0RelayResponder(this, "onResult", "onStatus");
I want to thank Mike Potter for his RemotingConnection class, which extends NetConnection and makes AMF0 work in ActionScript 3. Arp 3 makes use of Mike's class.
This is a preview release of AS3 and Flex 2 support in Arp. As such, I'm releasing it without having tested it extensively. Please feel free to report issues in the comments of this post or to contact me directly with bug reports, etc. I am planning on creating another version of the PizzaService application that makes extensive use of Flex 2 features such as data binding, states, the
Known issues:
- VOs being sent from remoting appear as plain objects in ServiceCapture. This may have something to do with how apply() works. If anyone has any ideas on this, I'd love to hear them. If you look at the invoke() method in the AMF0Service class, you'll see that the VO maintains its OrderVO datatype until the apply() call. Whatever is going wrong must be happening after this point.
- I refactored the backend (to use pizzas instead of orders as the property). This may break the other clients (Flash 8 and Flex 1.5) I'm going to look into this now and update things if they are, indeed, broken.)
Comments
by JabbyPanda on 2006-07-02 18:18:59
by Mike Britton on 2006-07-06 21:18:48
by picmicro on 2006-07-26 18:13:02
by pic_micro on 2006-07-26 19:57:36
by Praveen on 2006-08-29 09:08:31
by aral on 2006-08-30 13:16:30
by FlexibleGuy on 2006-09-04 10:05:35
public function setCredentials(userId:String, password:String ):void { addHeader("Credentials", false, {userid: userId, password:password}); }
Then you can use:var gatewayURI:String = "http://localhost/gateway.php"; var gateway:RemotingConnection = new RemotingConnection ( gatewayURI ); trace("Setting service authentication") gateway.setCredentials("username", "password"); var gateway:RemotingConnection = new RemotingConnection ( gatewayURI ); var pizzaService:AMF0Service = new AMF0Service ( null, "PizzaService", gateway );
in ServiceLocator.addServices method. I discovered this in some discussions between Jester and Patrick on the amfphp discussions. I'm still experiencing problems with my resultObj being undefined, but i assuming its unrelated. Anyways, great work as always!! keithby ktec on 2006-11-01 00:50:45
by ktec on 2006-11-01 01:02:42
by ARP Framework (Aral Balkan) « Flash Dummy on 2007-10-30 10:00:13
by Chris on 2007-11-29 21:51:36
by Aral on 2007-11-30 06:34:07
by Gábor András on 2012-02-10 22:47:12
by Gábor András gazda022 citromail hu on 2012-02-10 22:51:05