amfserver, a new module that integrates actionscript clients (flash, flex, air) with D7 services

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
rolf vreijdenberger's picture

Hi all,

we're in the process of releasing the amfserver, a new Drupal 7 services module that integrates with actionscript based clients.
This means it's usable for flex, flash and air applications.
It's amf handling capabilities rely on the zend amf engine from the zend framework.

At the moment of writing it is complete, tested and features all you can wish for:
- session authentication, even for cookie-disabled clients like air apps, the standalone flash player and the flash and flex authoring tool: essential for developers that don't want to test everything in the browser. This means you can log in and work on the drupal cms with the permissions of the user you are logged in as.
- integrates with the updated DrupalProxy class, the de-facto standard actionscript library for working with Drupal that now handles both D6 (with amfphp) and D7 (with amfserver) even though the underlying protocols have changed. No worries, this is fully abstracted away from the programmer. The opensource library by dpdk.nl is included in the module.
- it has been extensively tested and has a simple test suite with demo code that you can use to test your setup and the actionscript llibrary/classes included in the module.
- good documentation and easy setup.
- uses the normal way of flash remoting / amf traffic and it's a lot simpler than the earlier implementation of D6, so it's easy to write your own libraries, although I'd advise you to use the included library.

new developments will follow when there are new capabilities from the services module (like oauth)

it can be found here: http://drupal.org/sandbox/rolfvreijdenberger/1122068

any feedback or suggestions would be much appreciated and more than welcome

thanks for listening

Comments

Security?

Rockmeister's picture

Hello Rolf, how secure is this implementation? How long before authentication is build in?

Is there an onlinbe example where one can see this running?

Hey Rockmeister, security is

rolf vreijdenberger's picture

Hey Rockmeister,

security is built in via normal drupal session authentication. It differs from the D6 implementation and session authentication is now a native citizen of services.

On top of that, the amfserver has session authentication support for cookie disabled clients like the flash and flex authoring tool, the standalone flash player and air applications.

You can get the code via git (see the project) and there is a testsuite included which uses the opensource dpdk library for communicating with drupal (both D6 with amfphp and D7 with amfserver). The testcode shows you the high level actionscript code for easy integration with drupal via the amfserver.

Kind regards,

Rolf Vreijdenberger

drupal and flash: http://www.dpdk.nl/opensource/drupalproxy-as-a-bridge-between-flash-as3-...

Some assistance please....

Rockmeister's picture

Hello Rolf, I got the amfserver module along with the services module installed, zend framework is installed on a brand spanking new drupal 7 installation with all the latest dev files. It all seems to be fine. Can you explain to me what I need to do to set the endpoints and configure the module as well as the services module properly? At what point and where do I use the dpdk library? How do I configure the client Flash builder to access and work properly?

okay endpoint was configured!

Rockmeister's picture

Rolf, I get the following:

The amfserver with Zend Amf is installed and working
The endpoint name of this endpoint is: blah blah
The amfserver version is: 7.x-3.0-rc1
Endpoint authentication methods: 0

Is the above the correct message? Should I do anything else on the drupal install server side?

What do I need to do to gain access with flash builder 4? Can you guide me as to what I need to do to access the remote server and data from within flash builder 4?

Hi Rockmeister, the endpoints

rolf vreijdenberger's picture

Hi Rockmeister,

the endpoints are a services configuration and becuase the amfserver provides a service, you can set the endpoint (read: url to gateway) for it.
You have that working and the message is correct ("installed and working").

You should set the right permissions first, like access to nodes, etc, all the things you want to view/get/save etc via services. Take a good look at the services permission too.

You should also edit the resources, which is a part of the new endpoint you just created. a resource is essentially a method on a service, like node.retrieve (service: node, method: retrieve) which you have to make available on the endpoint, so you can consume it from your actionscript client.

when you're using flash/flex, import the dpdk library (especially the nl.dpdk.services.gephyr package with the DrupalProxy and DrupalData object) and please see either this demo http://www.dpdk.nl/opensource/drupalproxy-as-a-bridge-between-flash-as3-... which is for D6, but it's almost the same for D7 (only the constructor argument if it's D6 or D7 is different) and/or take a look at the actionscript demo/testsuite code (org.drupal.amfserver) to see how to set up a functioning client.

thanks for the insight, I'll provide (even clearer :)) messages for the endpoint and will update the help file so I can put all these issues in the help for the module, so you have it once it's installed. For the moment, there is some help on your installation: www.yoursite.com/admin/help/amfserver

Kind regards,

Rolf Vreijdenberger

drupal and flash: http://www.dpdk.nl/opensource/drupalproxy-as-a-bridge-between-flash-as3-...

This is a great and hope to

mrconnerton's picture

This is a great and hope to test it out.

I'm not sure what the changes in services module is for D7 but how is this different than http://drupal.org/project/amfphp? Is it just that that module hasn't been ported to 7 yet?


Matthew Connerton | matthew@aspiringweb.com
Aspiring Web a design & development agency

I'm sorry, nevermind. I read

mrconnerton's picture

I'm sorry, nevermind. I read the rest of the sandbox project description. Thanks!


Matthew Connerton | matthew@aspiringweb.com
Aspiring Web a design & development agency

Hey Matthew, the amfphp

rolf vreijdenberger's picture

Hey Matthew, the amfphp module hasn't been ported to D7, amfserver is the only D7 implementation out there and makes use of the Zend library instead of the old amfphp library.
The Zend library with amf is recommended these days for flash remoting. The library as a whole is actively maintained and the zend amf library is very stable.
Some other features include the updated way of dealing with sessions, an integrated actionscript library, sample services and code, help included in the module and a testsuite.

Kind regards,

Rolf Vreijdenberger

drupal and flash: http://www.dpdk.nl/opensource/drupalproxy-as-a-bridge-between-flash-as3-...

classmapping

rolf vreijdenberger's picture

Hi folks,

classmapping is now fully functional and configurable via the amfserver.
This means you can store and remove your classmapping settings via a form on the amfserver settings page.

from the help text on the amfserver classmapping page:


Classmapping can be configured here. Classmapping means you can create a mapping between a php class and an actionscript class for automatic conversion of a domain object on one side to a domain object on the other side.

Classmappings can be used in your custom made service module, so you can have strong typing and use classes both for the php side and the actionscript side of your application, without having to write code to do the conversion of flash data to php data and vice versa. You can use the data sent from flash as a native php object and vice versa.

See the actionscript demo code in the class org.drupal.amfserver.DrupalAmfServer (included in the module) and in the drupal module file amfserver.resources.inc to see how it can be implemented in your own module.
In essence you will have to mirror your php and actionscript classes' public properties and use the flash.net.registerClassAlias function in actionscript to map the object that is coming in from php to a Class in actionscript via the tag/alias that has been sent from php.
The php code (our custom service module in this case) will have a similar mapping that maps the 'org.drupal.amfserver.User' tag/alias to a php class. In the form presented below you can add the php mapping. When a mapping is defined via this form, each time you send a php object to flash via the services it will automatically be tagged with the as3 mapping

In the example actionscript code you have the actionscript mapping in this line of code:
registerClassAlias('org.drupal.amfserver.User', User);
Each time a php object is sent from php with the tag/alias 'org.drupal.amfserver.User', that object will automatically be mapped by flash to an instance of the User class (defined in the actionscript example with the same public properties as the php class).
Each time you will create a User object on the actionscript client and send the whole object via amf to the server, it will be tagged with the 'org.drupal.amfserver.User' alias and can be mapped to the php class by mapping the tag/alias to a php class. In this example we have used the php class 'AmfServerUser'.

The classmapping can be defined in php by using the form below and setting the name of the actionscript alias/tag and the name of the php class you are using.
The classmapping can be defined in flash/air with the registerClassAlias('org.drupal.amfserver.User', User) function in the class that's using the object.
The classmapping can be defined in flex with the [Bindable] and [RemoteClass(alias='org.drupal.amfserver.User')] metatags just before the class definition of the as3 class ('public class User' in our example).

The default classmapping presented on installation of the module is for the demo service and testsuite included with the amfserver module


cheers

Kind regards,

Rolf Vreijdenberger

drupal and flash: http://www.dpdk.nl/opensource/drupalproxy-as-a-bridge-between-flash-as3-...

amfserver module released

rolf vreijdenberger's picture

Hi all,

the amfserver has now officially been released for D7: http://drupal.org/project/amfserver

cheers

Kind regards,

Rolf Vreijdenberger

drupal and flash: http://www.dpdk.nl/opensource/drupalproxy-as-a-bridge-between-flash-as3-...

Services

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: