Active
Project:
AMFPHP
Version:
master
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Dec 2010 at 01:03 UTC
Updated:
4 May 2011 at 02:39 UTC
Jump to comment: Most recent file
Hello since there is now 7.x-3.0-beta1, is there any plans on someone updating the module?
Will the task be challenging in a particular way? I cant wait to test amf in d7.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | amfphp_server.zip | 88.91 KB | sylvain lecoy |
| #13 | amfphp_server.zip | 431.21 KB | sylvain lecoy |
Comments
Comment #1
sylvain lecoy commentedsubscribing..
I am writing a d7 version for service 3.0
Will update this post then.
Comment #2
imp7 commentedthat's exciting, I am not much of a coder but cant wait to test things :)
Comment #3
RAFA3L commentedsubscribing..
Comment #4
TheWizz commentedsubscribe
Comment #5
carlosg2 commentedsubscribe
Comment #6
autodidactic commentedSubscribed
Comment #7
biteuljiouce commentedsubscribing..
Comment #8
jyee commentedsubscribing
Comment #9
sylvain lecoy commentedI have a working copy of the AMF Server (with Service 7.0-dev) but I need some clean-up to post the code (I have issues in configuring the server: admin side).
You can have a demo of a flash drupal 7 driven website with Services 3.0 and AMF Server here: http://www.teorestaurant.com/
Once I'll finish the clean-up I can post the code then the maintainer can commit to cvs.
Comment #10
imp7 commentedlooking great Sylvain Lecoy, nice deeplinking.
I prefer flash sites to be stage.scaleMode = StageScaleMode.NO_SCALE , although I cant read the language, its impossible to read on a small window.
Cant wait to test Services 3.0 and amf.
Comment #11
nexus74 commentedchompin at the bit for AMFPHP for D7....
Comment #12
snelson commentedDoes anybody have any AMFPHP for D7 code to start with? Doesn't even need to be clean, but it'd be great to have somewhere to start from. I'll get a beta release up in the next week ...
Comment #13
sylvain lecoy commentedHere is my version of amfphp_server.
I included the library and removed the fancy stuff who dealed with php4 (and good riddance !). Since drupal 7 requieres php5, I optimized some part of the lib which I think can be included in the module since the version change very few and the project has become very stable.
The configuration is not working (I don't know why but the module base is working)
Comment #14
TheWizz commentedI tried your amfphp_server.zip in D7 with the current RC of Services, but couldn't make it work. Is there a complete working sample somewhere (including Flash or Flex code)? Or perhaps a screen-cast or tutorial on how to put all the pieces together?
FYI, I have successfully used AMFPHP under Drupal 6, where it integrates nicely with Views. I haven't found any Views integration in the D7 version. Perhaps those parts just aren't there yet?
-JM
Comment #15
asimov6 commentedI also tried the module in the zip file and couldn't get it to work at first. Then I discovered that while the module is named "amfphp_server", the code in AMFPHPGateway.php referes to the modulename as "amfphp". When I corrected this, the module started to work.
Comment #16
sylvain lecoy commentedOops you're right asimo, forgot to change the old repository.
Here is the archive with the changes.
Do not forget to put your endpoint in debug mode (service 3 feature) to connect from IDE: it will auto turn on the debug for AMFPHPGateway.
@impl7: I don't like the way my website scale as well, this is requested from my client but I will suggest him again to change for something better.
@snelson: I have some clean-up to do, and make the configuration working (the form doesn't display in the endpoint settings but I can't figure out why).
Do you need a co-maintainer ? I have some ideas to write tests for this module (flash based) and improves the Flash/Flex handling (e.g. Flex needs uid to identify objects but Flash doesn't then its a feature we can skip in case of flash based client).
I have written some function to set the explicitType and then retrieve native Flash class client side. The mapping is basically done with Drupal entities (User class for client, Node class in flash, etc.)
Comment #17
TheWizz commented@asimov6: Then I discovered that while the module is named "amfphp_server", the code in AMFPHPGateway.php referes to the modulename as "amfphp".
Yes, I figured that one out - assuming you're referring to this line:
require_once drupal_get_path('module', 'amfphp_server') . "/amfphp/core/amf/app/Gateway.php";
However, I still can't figure out how to make it DO something. I can get to the "amfphp and this gateway are installed correctly" page, but that's pretty much it. Clicking "Load the service browser" just gets me a "page not found". Is there something like a service browser that allows me to see and test the RPC operations? In the D6 version there were functions such as node.get, views.get, etc. Is this still there (e.g., Views integration)? The configuration where this was set up in D6 doesn't seem to be there any more.
A simple, working example would probably do wonders in allowing me to figure this out. Or if someone has the time to write up a brief tutorial on the steps required to get something very basic working, end to end. I've done both straight AMFPHP (without Drupal) as well as BlazeDS (Adobe's Java base counterpart), so I'm quite familiar with the concepts. I think I just need a little nudge in the right direction to actually get this off the gound.
-JM
Comment #18
TheWizz commentedHmm, actually think that it *is* working, sort-of. When attempting this call from Flash
drupal.call("system.connect", responder);I get a 401 response with the description
Access denied for user 0 "anonymous""/Applications/MAMP/htdocs/d7/sites/all/modules/services/services.runtime.inc"So I believe the call is getting through, but runs into some authentication problem. I run this test from Flash debugger. I.e., *not* from Flash embedded in a web page. I don't know how to handle the authentication in this case. Ultimately, I want to make the service calls from Adobe AIR, so hopefully this can be accomplished somehow.
Comment #19
sylvain lecoy commentedOk basically its more a Service module issue that you encountered.
When you set an endpoint, you have to tell what methods will be avialable on your endpoint by going to Resource tab. Here you can thick or not which methods you want to make visible for your endpoint. Service 3 has changed the way you provide accesses.
Views integration is part of the service module as well, amfphp_server, like the previous amfphp for drupal 6, is really just an adapter to connect flash to php. From my last experience, they didn't implemented yet Views service as wiews is not very stable for now.
Comment #20
TheWizz commentedI see. Any idea how I could authenticate from a Flash/AIR client using only AMF protocol? Or do I *have* to do this using a browser before starting to communicate frmo Flash (which pretty much rules out AIR, I guess)?
-JM
Comment #21
sylvain lecoy commentedAgain, this module is just a wrapper to make your application communicate with drupal through AMF3.0. It allows Object serialization/deserialization, object mapping (as3 classes to entity), and that's it.
In flash side you can set a header in the NetConnection object, and read it from php. Services implements two authentication methods: OAuth and Session, respectively OAuth Authentication module and Session Authentication module (which are packaged in the Service module).
Comment #22
TheWizz commentedI've made some progress, and believe I have the authentication part working. Now I'm trying to make a successful service call through AMF. I have two services configured, one REST service called "rest" and an AMFPHP service called "services". I can successfully make a REST call as follows:
http://localhost:8888/d7/rest/node/1What would be the corresponding Flash call to the "services" service? I've tried various permutations of the call parameters, such as
d7.call("node", responder, "view", 1);where d7 is the NetConnection connected to "http://localhost:8888/d7/services". Is there any documentation or pointers anywhere as to what I can pass as parameters when I call the service?
-JM
Comment #23
sylvain lecoy commentedhere is my class to communicate with:
In your case it should be .call("node.view", responder, 1);
Comment #24
TheWizz commentedMany thanks or your response. You put me on the right track again. However, after some spelunking inside the services module, I came to the conlusion that the proper syntax should really be
d7.call("node.retrieve", responder, 1);since "node.view" gave me the same problem as before. Can you confirm my findings, and that the proper syntax should indeed be "node.retrieve"? At least this does work and returns the contents of node 1. Where would be the proper place to look for the various nouns and verbs being used here? Incidentally, just looking at the UI in the services module seems to agree with my findings, as the operations on the "node" resource are named "create", "retrieve", "update", "delete" and "index". Presumably those are the exact actions available pn the "node" resource.
BTW, is it possible to control user access rights to these operations? I.e., I may want all logged in users to "retrieve", but only users with specific roles to "update". I guess this is more a general Services question than AMFPHP related, though.
Finally, many thanks for your detailed write-up titled "Class Mapping from Drupal Entities to Flash Object" at http://drupal.org/node/1048838
Comment #25
TheWizz commentedIt seems that the error checking in amfphp_server_method_call could be improved to avoid the difficulty I had. Passing the wrong operation name currently results in an "Access denied for user Xxx" error being returned to Flash, which is misleading in that it implies some kind of permission error. The reason for this is that the $controller being passed to services_controller_execute is undefined in this case, causing the call_user_func_array call to return un-TRUE. I propose instead checking for this condition in the function that calls services_controller_execute from the amfphp_server.module, something like this:
I assume I could try to provide a patch, but it's quite a simple addition [starting from "if (!isset($controller))"], so hopefully the above snippet will do fine, assuming you like the idea.
-JM
Comment #26
TheWizz commentedI ran into trouble using the user.login function of Services under D7 through AMFPHP. The reason being the AMFPHP authenticationFilter starting the session before the user.login action regenerates the session ID, causing the session ID cookie to be set to the old session ID in the response header. My solution was to simply remove the AMFPHP authenticationFilter by commenting it out in Gateway.php. It would seem to me that the Services module already takes care of authentication anyway, so the authentication in AMFPHP appears superfluous, and in this case actually caused harm.
Does this seem to make sense, or is the AMFPHP authenticationFilter actually serving some purpose also under Services?
-JM
Comment #27
danielm commentedsubscribing
Comment #28
ricovitch commentedsubscribing
Comment #29
danielm commentedhello everybody,
When I use #16 amfphp_server.zip and I go to admin/config/services/services/amfphp/charset I get the following error:
Recoverable fatal error: Argument 1 passed to drupal_attributes() must be an array, null given, called in /var/www/public/includes/form.inc on line 3107 and defined in drupal_attributes() (line 2258 of /var/www/public/includes/common.inc).
Thank you for your help
Sincerely
Daniel
Comment #30
sylvain lecoy commentedHello, The archive was actually provided with this bug. I didn't managed to know if it was Service related, drupal related, or my fault.
I will have a look this week end and get back to you.
Regards
Sylvain
Comment #31
kari.nies commentedSubscribing...
Comment #32
socialtalker commentedsubscribing
Comment #33
rolf vreijdenberger commentedHello all,
I've been pointed to this issue just a couple of hours ago so I thought I would let you know, for those interested in amf connection with drupal7, I have just released a sandbox project that is fully functional, tested, has an actionscript package ready to go along with both the D6 amfphp implementation and my amfserver D7 implementation, based on the Zend Amf engine.
It makes full use of session authentication and, here's a good thing, also for cookie disabled clients like the flash player, flash and flex authoring tool and air apps.
It's production grade and I invite you all to take a look.
see the module page for more info: http://drupal.org/sandbox/rolfvreijdenberger/1122068
cheers
Comment #34
giorgio79 commented#33
It looks like this is live http://drupal.org/project/amfserver
Awesome :D
Comment #35
snelson commentedFantastic work Rolf ... this is exactly what AMF and Drupal needed. Many thanks! I think it now makes sense to deprecate this AMFPHP module for D7, and I'll be happy to update the project page accordingly. Do you have any plans to backport to D6? Not that its necessary, just wondering ...
Comment #36
rolf vreijdenberger commentedHi Snelson,
Thanks and also many thanks to YOU for your work! We have all happily used the amfphp library for quite a time.
I might port to 6.x-3.x version of services, but I am not sure about it yet.
D6 has a fine version of amf integration and I am not sure that many people would mind using services version 2 with D6 and amfphp.
That said, the backport to 6.x-3x would not be that complicated since it will use other means of authentication than the 2.x version etc, so if there's a demand, I would be willing to do so.
cheers
Comment #37
nexus74 commentedI had a Flash menu that displayed all the primary links in D6 using AMFPHP and Services. I'm trying to this in D7 but I don't see any service for "menu.get." I have Services and the new amfserver modules installed. Is there an equivalent to "menu.get" ?
Here's my AS3 code:
The above code successfully connects to Drupal 7.
Thank you
Comment #38
rolf vreijdenberger commentedhi Nexus,
this is more of a support request for services, so this isn't the place to post. I'm guessing you don't yet know this :) It has nothing to do with either amfphp or amfserver.
There isn't a menu resource yet in D7 services, but if/when it's available you will be able to consume the service via amf.
You can check if there is an issue created in the services issue tracker, it's probably a feature request already.
cheers
Comment #39
nexus74 commentedRolf,
Thank you for your response. Ok, I'll keep a look out for the menu service. Thanks for the heads up
-N