Posts filed under 'Flex,AMF,PHP'
Patrick Mineault has created an alpha update of AMFPHP that now supports AMF3. He is looking for people to test it out. To help with this I have created two simple examples that I have running live on a PHP4/Apache server, as well as have tested on a PHP5/Windows box.
Basic Example
Return Array of VO’s Example
You can download the source for both examples by right clicking on the apps or get it here.
Note: To make the amfphp 1.9 alpha code to work with PHP4 there you need to implement a different function for the array_search() when the search needle is a object.
December 12th, 2006
I am excited to announce the release of an article on Adobe’s Dev Center, “Using Flex 2 RemoteObject and SabreAMF”.
I would like to thank Amy Wong, Adobe editor, and Evert Pot, developer of SabreAMF, for all the help making this article happen.
November 6th, 2006
I have created another port of the Adobe Flex Cairngorm Store example using ColdFusion RemoteObject on the backend. This example actually is created to show how to switch between different backends. The ColdFusion WebService implementation is not working at this time and I am trying to track down the Cairngorm 2.1 changes that has affect it or if the problem is else where. The 2 backends that are working are ColdFusion RemoteObject and AMFPHP with RemoteObjectAMF0.
Get the source here!
You can read more on the AMFPHP implementation in my previous post.
November 1st, 2006
I have updated RemoteObjectAMF0 to work properly with mx.rpc.IResponder implementation. I have also properly packaged it up as a component, including SWC, docs, example and source files.
You can find the updated code at http://renaun.com/blog/flex-components/remoteobjectamf0/.
There is a live demo example of the updated code running Cairngorm Store (Cairngorm 2.1 updated), AMFPHP and RemoteObjectAMF0.
October 31st, 2006
I went ahead and updated the Cairngorm Store example to Cairngorm 2.1. You can find the original example code download on http://www.cairngormdocs.org/.
Get the updated code here.
Here is my short list of changes:
- Changed com.adobe.cairngorm.business.Responder to mx.rpc.IResponder
- Changed com.adobe.cairngorm.commands.Command to com.adobe.cairngorm.commands.ICommand
- Changed com.adobe.cairngorm.vo.ValueObject to com.adobe.cairngorm.vo.IValueObject
- Deleted result and fault handlers on RemoteObjects components in the Services.mxml file.
- Used Call.addResponder( responder ) instead of resultHandler and faultHandler
- Changed onResult/onFault to result/fault
- Changed getService to getRemoteObject
Along with this update I have been updating the RemoteObjectAMF0 and got it working with the Cairngorm Store example. I’ll package the changes and PHP example up as a separate download, get more details in a future post.
October 31st, 2006
As more people are using the RemoteObjectAMF0 the component receives some updates. The update is in regards to the "makeObjectsBindable" attribute that is present on Flex RPC service components.
I used the HTTPService's makeObjectsBindable documentation to implemented a part of what makeObjectsBindable might do.
If makeObjectsBindable is true then the Array will be wrapped in an ArrayCollection.
Now you can bind the result straight to dataProvider value like:
ACTIONSCRIPT:
-
[Bindable]
-
[ArrayElementType("com.renaun.samples.login.vo.BookVO")]
-
private var books:ArrayCollection;
-
-
books = ArrayCollection( event.result );
-
// instead of
-
books = new ArrayCollection( ArrayUtil.toArray( event.result ) );
You'll find the source and example changes in the here.
October 17th, 2006
If you use PHP and want to see some examples of how to use it with Adobe technology, specifically Flex, you need to check out the PHP RIA SDK by Adobe.
I have in the past created two simple examples of how to use AMFPHP and Flex to return typed object data with PHP. These examples have been contributed to the PHP RIA SDK by Adobe source repository. You can find the two examples on the google code PHP RIA SDK repository here.
October 10th, 2006
In my first attempt with WebORB for PHP I came across an issue that was not keen with the examples I was trying to use. The issue had to do with using the "source" attribute on the RemoteObject class. The reason behind the missing feature in WebORB for PHP was that they modeled their services config files after FDS, which is JavaAdapter based. My examples are based on ColdFusion and use the standard services-config.xml <source>*</source> attribute defined for the "ColdFusion" destination, which is created by the ColdFusion connectivity feature in 7.0.2.
Continue Reading September 23rd, 2006
The midnightcoders have provided a nice package to use RPC services with Flex and PHP. The newly release WebORB for PHP is an exciting project. For there site:
WebORB for PHP is server-side technology enabling connectivity between Flex and Flash Remoting clients and PHP applications. WebORB for PHP can be installed into any PHP5 application to expose PHP classes as remote services. The product provides a complete implementation of the Adobe's AMF0 and AMF3 messaging protocols and thus supports any Flash Remoting or Flex client.
Although this release only supports the RPC featureset of Flex Data Services it is planned for future FDS features. Their documentation and Quick Start guide are top notch and should be easy to follow. They use a deployment folder structure of "Weborb\WEB-INF\flex\" making it easy to use the New Project Wizards in Flex Builder to make FDS or ColdFusion connectivity projects.
Configuration
Now I usually like to take these projects and apply my standard Flex, AMF, and PHP example. This is where I ran into problems. The configuration files are setup disctintly like FDS. I tend to follow the ColdFusion connectivity default configuration files and setup one Destination tag with a <source>*</source> attribute. The * attribute value is not support in the current WebORB for PHP. You need to define the specific source for each destination tag in the services-config.xml (actually in the remoting-config.xml that is included in the services-config.xml).
I added the following to the remoting-config.xml
<destination id="LoginServiceDestination">
<properties>
<source>com.renaun.samples.login.services.Login</source>
</properties>
</destination>
The example Flex application is from my example code used in the RemoteObjectAMF0 and my SabreAMF example. You can get the my example code here.
Object Type Mapping
Object typing is a very important feature when working with RemoteObjects and Flash Remoting. FDS and ColdFusion connectivity have built in mechanisms that handle object typing for you. But other packages like SabreAMF, AMFPHP or OpenAMF you need to set the mapping manually. This is where WebORB for PHP uses PHP5 features to make object typing automatic, no manual attributes, method tables, or class mapping functions.
The hiccup was that the object typing didn't work quite right. The example code provided by WebORB for PHP and my custom BookVO example had an extra ".htdocs.Services." attached to the class type. I tracked down this issue to Util/TypeLoader.php class in the getFullClassName method. You get to set your services path in the Weborb/weborb-config.xml (default is <weborb servicePath="../Services">). The fix to get the correct object is to add "$servicePath = realpath( $servicePath );" in the getFullClassName method right after "$servicePath = $config->getServicePath();".
Conclusion
Overall WebORB for PHP has great potential. The project is backed by a group that create many great products for Ajax, Flash Remoting and Flex on many different platforms. We are lucky to have them provide this project as open source. I am particularly interested in the further development of FDS polling and data management features.
September 6th, 2006
Flex 2 provides many new and exciting features. One of the improvements is the new Action Message Format or AMF3. AMF is used with RemoteObject’s components and requires a compatible server. The newer AMF functionality provides improved performance and better object typing.
Current AMF integration is predominantly done through the ColdFusion connectivity update found in ColdFusion MX 7.0.2 and Flex Data Services. PHP and other open AMF projects have been catching up to the AMF field. More and more PHP servers and clients are supporting the AMF3 format, now it’s a question about how easy is it to integrate and use with Flex 2 applications. This article we’ll explore such a setup using SabreAMF.
Read the rest of the article here
September 1st, 2006
Next Posts
Previous Posts