Now that the services module works with Drupal 6, are you planning on porting AMFPHP to DRUPAL 6?

I have already created a .info file and changed some things in my 5.x version to allow it to work within drupal 6 but I'm not very familiar with Drupal's API, especially the new one, so when I create a flash project, which worked fine for drupal 5 but just remains blank in drupal 6, probably because the functions are not getting called. When changing the .module file, I didn't find much related to drupal's callbacks or services callbacks.

I have attached my poor "hacking" work to this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JoachimVdH’s picture

Version: 5.x-1.x-dev » master
FileSize
1.75 KB

at first everything looked fine. It installed perfectly, if you test the service, everything ok.
Then tested with one of the drupal examples. (http://drupal.org/node/118136 ).
First got some errors, so started looking into code. Installed coder module, adjusted a few spaces etc., added a line for logging, removed trigger_error. Error changed into blank. This was not the result i wanted to see.
What is going on ...
Back to services ... test a node.load, seems that keys and sessions are on. Turn this of in services > settings and problably you're back on the road.

i'll post my changed module.

i'll hope there will soon be an 'official' amfphp drupal module

Anonymous’s picture

Thnx for the update eldude buddy ol pal! Will check how it works later. However, I use sessions in my Drupal Actionscript so I will give you some feedback if it doesn't work.

Until then... have a top one!

Anonymous’s picture

Just some feedback for ya... Your port-to-D6 corrections seem to be working fine. I now have access to all the existing services via flash. Nice one dude! Have a top weekend!

JoachimVdH’s picture

you're welcome, tnx!

Joachim

JoachimVdH’s picture

FileSize
2.6 KB

herewith a patch :

* watchdog instead of trigger_error
* sourceforge instead of 5etdemi
* basicly tested with amfphp-1.9.beta.20080120.zip
* ran module through 'coder', so there are a lot of space and tab changes

hope to see amfphp_6.x-1.x-dev soon ;-)

Joachim

kremisos’s picture

I just wanted to say you guys are amazing. I truly envy your talent. I'm sort of new to the Flex scene, and am a beginner in PHP (despite working with it for several years). I unfortunately haven't really had the time/money to do this, but I'm pretty dedicated to learning this stuff, so I'll keep you updated (on whether or not a newb can figure this stuff out).

Really, I'm feeling pretty comfortable with this so far. So far, so good.

I just wanted to say again. You guys are amazing.

Do you know of any good links for reference material? I'm not completely lazy. I did buy a book on Flex and Drupal integration and highly recommend it for a newb.

The title is:

Flex Application Development by AdvancED. (no I don't work for them lol)

At any rate, keep up the good work. =D

JoachimVdH’s picture

a good starter is the services handbook ( http://drupal.org/node/109782 )
which also has a flex tutorial ( http://drupal.org/node/113697 )

snelson’s picture

All,

AMFPHP head *should* now work on D6, but before I create a branch, could somebody test it out? You can get it here, but the snapshot might not be current until tomorrow, so you can checkout head to be sure.

eldude - I couldn't apply your patch, so I basically just updated the .info file and the line.

http://drupal.org/node/96669

JoachimVdH’s picture

FileSize
1.68 KB

Scott,

I did a simple test, with one of the examples from the handbook. And it works fine.
I'll hope to do some other tests real soon.

herewith a patch ( hopefully this one works)

what's in it :
* !variable_get instead of variable_get (http://drupal.org/node/224328)
* watchdog instead of trigger_error ( generates drupal log messages)
* readme.txt path to amfphp to the new path

Joachim

cognizen’s picture

Hi guys,

I'm very excited about the prospect of tying flash to drupal 6.... After following the instructions for installing I have been getting these errors:

* warning: include_once(./modules/amfphp/amfphp.module) [function.include-once]: failed to open stream: Permission denied in C:\wamp\www\drupal\includes\bootstrap.inc on line 558.
* warning: include_once() [function.include]: Failed opening './modules/amfphp/amfphp.module' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\drupal\includes\bootstrap.inc on line 558.

Any ideas on how to resolve?

Thanks,
Phil

JoachimVdH’s picture

which codebase did you use ?
cvs only, cvs + latest patch ?

when does the error occur ?
when installing? your first connection from flash.. ?

does services works correct? can you browse a node.load ?

you have php 5.2 or higher ? (it's needed for amfphp 1.9... from sf.net)
( see status report in drupal, everything has to be green ;-) )

thanks 4 feedback

Joachim

cognizen’s picture

Thank you Joachim,

It was actually throwing those errors in Drupal.... I found that it was a rights issue and just chmod the module file to 755 and all seems to be well. Though, shortly after I tried to run the first flex example and got an error saying that I couldn't connect to the DB.... I didn't have a chance to dig in as I had to take my kids out to dinner but I'm going to dig back in here shortly....

I'd also be very interested in kind of an overview of what this does differently than a straight up amfphp app - I'm assuming that it is basically a wrapper that translates from normal remoting to Drupal? My apologies for the newb questions - I've been looking at Drupal for about 3 hours.....

Oh yeah, two more things.... You asked if I had pulled from the CVS - I'm actually utilizing the patched version from the links above - Starting from the link in the first response and then adding the .patch in the post just before my first and utilizing the latest release of amfphp from sourceforge..... Should I be doing something differently?

And #2 - Is there an example of a Flash CS3 app utilizing this module?

Thank you,
Phil

JoachimVdH’s picture

i didn't saw a tutorial yet starting from flash cs3. But you can see to the source @ http://drupal.org/node/177465#comment-640551 ( if you just compile this source it's create a simple test canvas).
If you google (or yahoo) on amfphp and flash cs3, you will find some tutorials. The only difference is as always the path to the gateway, and the method you request.

Joachim

cognizen’s picture

Thank you Joachim,

The example is excellent - it showed me how to pull data from nodes. Unfortunately, I also need to put data into nodes. I am using Drupal 6 along with the Head AMFPHP module for Drupal 6. The problem that I'm running into now is trying to put content into the db. I receive errors in drupal logs and have no success inputing to the db when I attempt any of the tutorials that I've found (Addresses tutorial, Recipe Tutorial).

Thanks,
Phil

ven-1’s picture

Anyone have any idea why i get the error, when i install services/amfphp and go to the Services menu in Drupal and click the AMFPHP service?

Fatal error: Uncaught exception 'VerboseException' with message 'realpath(): Unable to access drupaldir/services//' in drupaldir/modules/amfphp/amfphp/core/amf/app/Gateway.php:296

JoachimVdH’s picture

have you installed amfphp inside the amfphp-module ?
see the readme file inside the amfphp-module.

Joachim

snelson’s picture

Committed eldude's last patch: http://drupal.org/cvs?commit=110241

Jody Lynn’s picture

HEAD is working great for me with D6. Could you make a branch for it and a release for the project page? Thanks

alippai’s picture

It works for me :)

evanr’s picture

Category: task » support

I'm new to Drupal and AMFPHP and am trying to set this up based on info in this thread. I think I followed everything exactly, though I didn't apply any patches (I'm not sure how to do that). Drupal shows the AMFPHP HEAD module is enabled correctly.

When I try the sample app and click the "Load that Node" button which launches "node.load(1)" I get the error below:

fault: [RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://{my-drupal-url}/sites/all/modules/amfphp/amfphp/services'"]

Can someone please help me with this?

alippai’s picture

Do you have Global redirect module enabled? You have to disable it, it's incompatible with AMFPHP - I posted an issue (I think it's between Services issues...)

evanr’s picture

I don't even see the Global redirect module listed in the modules page. Is that part of a package that I was supposed to install?

Everything works in the AMFPHP browser when I do tests of my own services. Is there something else I need to add into the services folder so I can test the Drupal services through AMFPHP's browser?

marita93’s picture

Priority: Critical » Normal

I'm having two puzzling problems and perhaps they are related. Anybody have an idea what I am doing wrong?

I've installed Drupal 6.3, Services 6.x-1.x.dev, amfphp 1.9 Beta 2

I get the message

"amfphp and this gateway are installed correctly. You may now connect to this gateway from Flash."

however, on that page, when I click on the services browser, I get a page not found error.

When I try to connect through my flex application I get the following error:

fault: [RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Security.Error error Error #2048 url: 'http://localhost/mywebsite/services/amfphp'"]

It's a security error, so I made sure that all the security boxes for services are unchecked (use keys, strict domain checking, use sessid) and that anonymous users can access web services.

Any help would be much appreciated!

JoachimVdH’s picture

The page with the link to the service browser you get, is the standard gateway page you when amfphp is working correctly. However, in drupal the browser is not functional.
* the path is not correct for working in drupal environment
* drupal services are not classes like in amfphp, but functions. This setup will by default not work in drupal.
( see issue http://drupal.org/node/167690 )

have you tried an example first ( http://drupal.org/node/118136 ) ?

i'm not sure, but is also possible that your drupal installation has to be in the root of your url ex: http://dr6.localhost/services/amfphp
instead of http://localhost/mywebsite/services/amfphp, so use http://mywebsite.localhost/services/amfphp
for more explanation how to get to this point http://drupal.org/node/288126

Joachim

marita93’s picture

Hi Joachim - thank you! I think that did the trick. I got it to work by moving it to a hosting provider with the installation at the root of the installation. This wasn't a definitive test however, as I also switched to a simpler flex example.

jbligh’s picture

So I'm no drupal expert, and I may not have the latest version of the HEAD code
the amfphp.info file says 2008/02/27 20:11:47, if that is any use seems like it should be April if i'd got the right code
Anyway...
For me everything worked fine except system.connect which just returned false.

I tracked the problem down to amfphp_fix_uid function,
the system.connect method includes a session variable in the user variable which has serialized data including uid,
when it is serialized by the function it is a string of X length,
after str_replace the string is X+3 in length as uid has been changed.
This breaks the deserialization step which is still looking for a var of X length

hope this is of help to someone

CHEETAH’s picture

Title: AMFPHP for DRUPAL 6 » WE <3 SCOTT NELSON !

WE <3 SCOTT NELSON !

bmcmurray’s picture

Title: WE <3 SCOTT NELSON ! » AMFPHP for DRUPAL 6

changing title for clarity. We do all love you, Scott, but this thread has nothing to do with that :)

psycrow’s picture

Jody Lynn’s picture

Status: Active » Needs review
FileSize
7.37 KB

Here is a cleanup patch for HEAD.

This patch moves amfphp_requirements to an install file so that the installation warning can fire at the time of module installation.
It also is a general code style cleanup and improvement to the README.
The issue in #320019: Bad path in HEAD is addressed as well.

No major changes.

Let's keep this thread devoted to patches and patch reviews moving towards having a Drupal 6 branch.

Bensbury’s picture

Hi folks,

Which is the current up to date patch?
And which is the current up to date file that needs patching?

The patch references $Id: amfphp.module,v 1.9 2008/04/12 01:09:53 snelson Exp $

The file from the module is from 2007.
I found one in a link at CVS but that dates 2008/02/27

So I am confused to which is the correct version and where I can find it.
Can anyone point me in the right direction?

Is it possible to post post patched files too?

I don't mind getting in and patching it myself (albeit it being a bit scary) although it'd be nice to have a clean version that works and I can look at to compare to the old one.

Thanks.

Jody Lynn’s picture

The patch is against HEAD, as stated.

Please see http://drupal.org/patch/apply and keep support requests as a separate issue.

nickgs’s picture

I just gave this a shot. I followed the following steps:

1. Check out the current HEAD version. For a CVS reference see: http://www.dottedidesign.com/cvs-cheatsheet

2. Applied the patch in comment #30.

3. Installed AMFPHP 1.9 Beta 2 in the AMFPHP module directory. http://downloads.sourceforge.net/amfphp/amfphp-1.9.beta.20080120.zip?mod...

4. Install the AMFPHP Drupal module into Drupal.

I wrote a quick Flex app to load nodes and it worked like a charm.

Jody Lynn’s picture

Status: Needs review » Reviewed & tested by the community

Thanks nickgs

nickgs’s picture

FileSize
526.15 KB

No problem.

Attached you can find the test Flex app I whipped up. Very simple but could be useful in testing.

NOTE: Make sure to change the services-config.xml to properly point to services/amfphp. And compile with: -services "services-config.xml"

Bensbury’s picture

FileSize
914.08 KB

Thanks folks.
I got it working by following the

http://thanksfornotsuing.com/discussion/flash-integration-drupal-6 link posted above.

Then changed one line from the code as stated in the tutorial.
Thankfully everything appears to be working and I did some tutorials and built a custom module thanks to Scott Nelson.

I haven't added the patch because I don't understand it.

I read comments about people not understanding Drupal and there is a clearly apparent void between the people who know and people who don't.
I feel somewhere in between at the moment.

So bear in mind talking about HEAD doesn't explain much to new-comers.
If someone asks where is the file, it probably means they don't know what people are talking about, not that they can't be bothered to read the comments.

In fact quite the opposite...(I had previously followed all the links and advice from external services tutorials) and so after a bit of searching I kind of figured it means here:

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/amfphp/

...in the CVS repository. CVS = HEAD? I think I read that in my search.

However I still don't understand why someone can't just post a patched file as well rather than make people go and patch it themselves.

Therefore, for the sake of boneheads like me I've simply zipped up my working services module & amfphp module for people who just want to get it working to drop into their modules folder.
It may not be the most current one but you can get it working, play about with it and then feel happy about hunting down the latest greatest version. There is so much this module can do!!

There is also included a custom folder with a custom module of Scott Nelson's 'Hello Service' from the video tutorials which are found here: (because when you follow the video you can't see what he is writing)

http://drupal.org/node/144141

If doing posting this breaks some kind of ettiquette then I apologise.
I get the feeling it might because someone would have done it already.

However I'm just trying to supply what I needed when I came looking for the answers and hopefully people who are around my level of Drupal understanding will benefit and then be able to step up to a better level of understanding.

Services and services with amfphp is outstanding!!! So I wouldn't want anyone to miss out on using it.

Attached is a zip including 3 folders (services, amfphp,custom) all set up to work.
Just drop them into your site/modules folder.

Then you can enable the services module, amfphp module and custom hello.say module from Drupal module menu.
In the custom/hello_service folder there is a Flash CS3 file.
This Flash file has two examples in the code:

The first calls the node.get service and returns node info to Flash.
The second calls the custom hello_service and returns a sent string to Flash.

The only thing you need to do in the CS3 file is alter the path to your Drupal folder.
It is commented so you should be able to find it easily.

I just tested it by dropping it into a Drupal 6 installation I had and everything worked first time, so I hope it works for you.

videohead’s picture

Awesome work! This works like a champ. You 'da man!
Thanks for doing this - i was totally lost and now have a working AMFPHP setup . . . except :
Services browser doesn't seem to work at http://myurl/modules/amfphp/amfphp/browser/
Returns a 500 error.
Any ideas?

Bensbury’s picture

I'm not Drupalled up at the moment as my PC is being changed.
However I remember something like, that the amfphp browser shouldn't work because it's not a proper installation of amfphp.
However it works in services and you can make calls to services from Flash.
The ampfphp browser not working is not a problem because it is not supposed to work.

Ryanbach’s picture

Priority: Normal » Critical

Requesting a 6x branch.

carvalhar’s picture

hi,

i don't get any error, but my event.result always return null... do you have any ideia why?

syakely’s picture

Building on egeos contribution I built two example Flash Classes, used to display a Taxonomy's Vocabulary terms, into a flash combox, while using an api key, and session id. The First class has an amfphp/drupal service call, and the second handles the hash using the api key and session id.
Drupal 6 / FLASH / AMFPHP / KEYS / SESSID

Hope this helps some.

RAFA3L’s picture

Category: support » bug

Finally I get all working fine, but I notice something wrong with the Views Service (views.get), the "fields" option don't work and when I check inside the "views_service.inc" under "views_service_get" function there is nothing about "fields", the argument is there but inside the function nothing happen.

I can solve this getting first all the nid with the views service and then call each node but I think is not the best solution.

syakely’s picture

you may have an old version.
It works for me and

@ line 21 views_service.inc

function views_service_get($view_name, $fields = array(), $args = array(), $offset = 0, $limit = 0) {

I may also not totally understand the problem. Are you saying it dose not even work in the drupal admin?

RAFA3L’s picture

I have the last version of service, services-6.x-0.13 and this line look like mine, but as you can see the argument $fields don't have any use inside the all view_service.inc.

If you call the views.get from the drupal admin only show:

[nid]
[node_vid]
[node_type]
[node_created]
[node_title]
[node_revisions_teaser]
[node_revisions_format]

in the version 5 of Services this look like this:

function views_service_get_view($view_name, $fields = array(), $args = array()) { 
  $view = views_get_view($view_name);
  if (is_null($view)) {
    return services_error('View does not exist.');
  }
  
  // Check access
  if (!views_access($view)) {
    return services_error('You do not have access to this view.');
  }
  
  $result = views_build_view('result', $view, $args);
  while ($node = db_fetch_object($result['result'])) {
    $nodes[] = services_node_load(node_load(array('nid' => $node->nid)), $fields);
  }
  
  return $nodes;
}

This mean that when you call a view you are calling the node service inside a loop and this don't exist in the version 6.

syakely’s picture

This seems to be more of a Services / Views issue than a amfphp for drupal issue.
I think
http://drupal.org/node/305155
is a running bug report on the same problem your having.

Sorry I could not be of any help with this one.

RAFA3L’s picture

heheh, I already did exactly the same of this patch!

thanks

snelson’s picture

Assigned: Unassigned » snelson
Category: bug » task
Status: Reviewed & tested by the community » Fixed

All,

I've created both a much anticipated dev and beta release for D6. Not much has changed, just support for D6.

Enjoy,
Scott

Bensbury’s picture

Issue tags: +amfphp, +services, +Drupal 6, +node.save, +user.save, +flash

This is a follow up to my post at #36.

If you got everything working and the Flash example going then this is about how to go a step further.

However firstly I would update the Services module and the AMFPHP module.

I'm writing this from my frustration of not being able to find a simple answer for normal people when wishing to save nodes and users.
Also the old services instructions for save.user are WRONG.

*For the sake of having it all work make sure you give permissions to edit all the content types.
! If in doubt just give anonymous user permission to everything and fix it when you are happy AMFPHP works.

So with no further ado:

To use node.save and user.save you have to pass an object as the argument.

myService.call('user.save', myResponder2, user);

To do this we set up our object before:

var obj:Object = new Object;
	obj.name = "Fruit";
	obj.mail = "fruit@fruitland.com";
        myService.call('user.save', myResponder2, obj);

This is the basis for all our Druplash glory.

Now what people don't tell you is what 'properties'/Fields you have to include in your object to make Drupal happy.

So here we go:

node.save (create a new node): You must have title and type. Drupal assigns and returns the node id.

var obj:Object = new Object;
	obj.title = "Why no one tells you the easy way";
	obj.type = "page";
        myService.call('node.save', myResponder2, obj);

This will not be published, so check your content list to see it added.

node.save (edit an existing node):

You must have the node id (nid) and use the 'changed' property setting it to true.
You can then change the properties you like.

var obj:Object = new Object;
	obj.nid = 26;
        obj.changed = "true";
	obj.title = "It is so much easier now";

        myService.call('node.save', myResponder2, obj);

CCK Fields - Some fields in your node can be hard to get at. I don't have the answers for all of this but the standard form appears to mirror the following code.

CCK field properties always start with field_ with the name of the custom field afterwards:

eg field_explanation

The CCK Fields (Text/Integer) data appear in the field as another object.
To create them and edit them you have to send an object to that field.

You need to set up a funky associative array as the property for the field.
In this case I use Arrays because it worked.

node.field_explanation = new Array({value:"Put your information here"});

It is also possible when you get clever (for normal people level) to add extra fields.
*This can be set in the content Type fields section.

node.field_face = new Array({value:"Put your information here"},{value:"Be happy"});

That is a far as I got playing with nodes:

Here is an example for editing node 14 (How you get the node id in the first place is up to you)

 var node:Object = new Object;
	  node.nid = 14;
	  node.type = "panel";
	  node.title = "TV";
	  node.field_face = new Array({value:"Sieze the crepe"},{value:"Crepe diem"});
	  node.field_dimensions = new Array({value:89},{value:32},{value:2},{value:45},{value:45});
	  node.body = "Whoopie";
	  node.changed = "true";
       
          myService.call('node.save', myResponder2, node); 

Glorious!

So now it's time for Users.
Same principles apply except someone was really naughty in the Services description and said it needed a user id. This isn't true and now fixed. What you need to send is an 'Account' but no one seems to want to explain what sending an Account means.

Therefore I hope this will save some pain!

user.save (create new user):

To create a new user you have to send an Object again. This Object has to be an 'account'.
WTF does that mean?
Well I finally figured it simply means you have to send the required fields for setting up an account when you make a new user from ther add user page.

It is horribly simple as there are only 2 required fields: name and mail.

So to create a new user just send a name and an email address. Drupal assign and then returns the user id (uid).

var user:Object = new Object;
	user.name = "Fruit";
	user.mail = "fruit@fruitland.com";
	 myService.call('user.save', myResponder2, user); 

It is so annoyingly simple that I am baffled why it just can't be explained in layman's terms.

user.save (edit new user):

This is easy now we know about sending objects.
To edit and save a user you just need to send any updates and include the user id (uid).
Including the user id tells Drupal to edit and save on the user.

 var user:Object = new Object;
	   user.name = "Vegetable";
	   user.mail = "fruit@fruitland.com";
	   user.uid = 4;
	   user.status = 1

    myService.call('user.save', myResponder2, user); 

--------

Using user.get and node.get is really handy for seeing what fields/properties you can update.

I trawled quite a few forums to find a decent explanation regarding this and got frustrated by
replies that seemed to miss the fundamental part that explains what fields you need to actually have drupal accept your changes.

So I was hammering drupal with incorrect calls.

In summary:

node.save (create): Needs 'type' and 'title' in your object.
node.save (update): Needs 'nid' (node id) and 'changed' set to 'true'. : plus your changes of course ;)

user.save (create): Needs 'name' and 'mail' in your object.
user.save (update): Needs 'uid' (user id). : Does not need a changed value like node.save

I hope that helps people looking to get into Drupal and Flash.
(I hope I make sense! :p)

My next mission is handling the log in and making it work with permissions.

Cheers.

syakely’s picture

Status: Closed (fixed) » Fixed

Thanks again EGO!!!

Question: Why try to do user log in with a flash application?

Currently, I have my drupal site handle users (reason I use drupal). Once the user has logged and has access to files (swf) uploaded (private_upload), I provide links to launch my flash apps. The flash app looks at the drupal user cookie (session ID), and knows who the user is.

IMO, I don't like my flash app exposed to the world. Just the peeps I have already allowed into a group (OG).

Bensbury’s picture

No worries.
I want to handle the log in through Flash as I want to build the entire site in Flash using Drupal for dynamic content.

It also then has applications for multi-user Flash games.
It's all part of the grand master plan.

DrplMG’s picture

Hello I have the following configuration : (just unpacked from services-amfphp-pack.zip #36) :

Drupal 6.9
Services 6.x-0.13
AMFPHP HEAD (patched)

All congiured and working on browser : system.connect, node.get etc. and myServiceURL is pointing correctly to amfphp service and says :
amfphp and this gateway are installed correctly.
I am using sessID for security setting ( also tried with sessionKey or nothing ) but still have this problem when connecting on 'system.connect' from AS3 :

Error #2044: NetStatusEvent non gestito:. level=error, code=NetConnection.Call.Failed

--- AS3 CODE -----

var myServiceURL:String = "http://localhost/FlashDrupal/services/amfphp";
myService.objectEncoding = ObjectEncoding.AMF0;
myService.connect(myServiceURL);
var myResponder:Responder = new Responder(getSessID, onFault);
myService.call('system.connect', myResponder);

-------------------

Any ideas ? Thanx in advance
Marco Gonnelli

Bensbury’s picture

The only things I can think of are:

First don't use sessionID or Keys at all - Turn them off - Best to make sure.

Then go brutal with permissions and make everything okay for anonymous users (because Flash gets considered an anonymous user I think).
Then run the updates, run cron and give it a go.

I found out a lot of my pain resulted from not changing the permissions which becomes more relevant as you add new node types and other modules.

However it would also be a good idea to download the latest services module and amfphp module as they are official and friendly now.

The only other possible thing I can guess from your post is the capitals in the url string.

Usually it is best to keep urls all lower case and I don't know how Flash/amfPHP or Drupal would treat them.
Long shot would be change your 'FlashDrupal' folder to lower case and then change it to lower case in the code.

I have it running here and my code matches yours.
I had it running with session keys on too.

syakely’s picture

(because Flash gets considered an anonymous user I think).

Yes, it dose when your running the swf from your desktop (flash application). (and maybe from other wwws?, have not tested.)

No, it dose not when deployed from your drupal server host, playing from a browser that has a currently logged in drupal User.

Therefor, while developing I allow anonymous to access services. Once I upload to my server, I turn that off,
and make sure my wanted roles have access to services.)

syakely’s picture

node.save with cck Node and User References. node.save with organic group.
Building on post #48

If you are saving a node with a required user or node reference, instead of using value: you would use nid: or uid:
as such:

var obj:Object = new Object;
			obj.title = 'new title';
			obj.type = "custom_type";
			obj.field_custom_node_ref = new Array({nid:flashvarNodeID});
			obj.field_user_ref = new Array({uid:flashvarUserID});
			obj.field_cck_text= new Array({value:'wooo'});
obj.og_groups= new Array();
			obj.og_groups[groupNodeID] = groupNodeID;

using the node.get service on 'admin/build/services/browse' page helps to identify how drupal is looking at these fields.

Organic Group is kinda funny as you use the Group Node ID twice.

syakely’s picture

node.save to EDIT a node that belongs to an OG.

node.save to EDIT will not work from desktop when trying to edit an OG node.

Works if I am using the swf inside the browser, while logged into drupal as an OG user.

node.save works from desktop, when making a new OG node.

The problem is at:
details: site.com/sites/all/modules/og/og.module
level: Unknown error type
description: array_diff_assoc(): Argument #2 is not an array
line: 1954

$current_groups['accessible'] = array_diff_assoc($current_groups['accessible'], $user->og_groups);

$user->og_groups is not being accessed. Seems like OG is not connected to the service calls? That is, when I use service calls or create a new service call, I can use $user to get access to the user info by passing in the sessionID. After I do that, drupal seems to know what user I am, even from my desktop. OG seems to be it's own entity when I try to do an update, as the only way for me to update a node is to do it with flash inside the browser and OG can look for the user sessionID...... but this dose not make total since, as I am able to access OG private content from my desktop.

Anyone have any ideas? Not really a super big deal, as I can get it to work once I move the swf to it's place on the server, but not super fun for developing.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sskully’s picture

Status: Fixed » Closed (fixed)

Hi, thanks so much for put these files together.
I've been looking for something like this for weeks.
I'm having on little problem though.
I've set up the myServiceURL to my drupal install on my localhost --http://localhost/VSA_drupal/services/amfphp
But I'm getting an error with the sessionID:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at example_fla::MainTimeline/getSessID()

Would you have some insight into this problem?

Thanks again!

sskully

Bensbury’s picture

Sounds to me like when you connect, the return object isn't sending back a sessionID.

So check the services->settings and see if the box 'use sessid" is checked.

If it isn't ...... check it.

Else if you like you can keep sessID unchecked and just remove references to sessid and SessionID in the code.

/// Also update for getting AS3 and Drupal working....

Arguments for Views service:

Let's say you are making a Multilingual site and you are targetting a view that pulls in blog entries.
You want the Japanese entries.

All you have to do is make a new array and feed the arguments into that array.
I think you also have to position the array in the correct place, meaning you need to make a dummy array for the fields parameter.

var view = "blog";

var fields:Array = new Array();  // make dummy

var args:Array = new Array(); // make argument array
args = ["ja"];

 service.call('views.get', responder, sessionID, view,fields,args);  

That should do it.
Hope that helps someone.

rolf vreijdenberger’s picture

Hi all,

in the hope it helps some of you guys with developing or testing, we've just released a new drupal connection framework for flash and flex. It uses sessions and authentication keys if needed and has a strongly typed api (but not for nodes and user objects).
you can find it and read about it (including code demo) here: http://www.dpdk.nl/opensource/drupalservice-as-a-bridge-between-flash-an...

kremisoski’s picture

Category: task » support
Priority: Critical » Minor
Status: Closed (fixed) » Active

I just have a question regarding user.save Is it possible to add a new user with a password? So far I've only seen information on supplying a username and email address. I was hoping to make a Flash registration page with more details and the password...

Sorry about the priority and status. For some reason I can't edit it, and I really just wanted this to be a general comment =/

Jody Lynn’s picture

Status: Active » Closed (fixed)

An issue queue needs to be organized to be effective, with separate issues opened for separate questions and titled appropriately. This issue is about porting AMFPHP to Drupal 6, and is closed. If you have a support question, that belongs as a new issue. This is just general practice for throughout the Drupal issue queues.

jomesili’s picture

syakely, I am trying to save a node that is created of CCk fields, my issue is the node.created field, could you give a valid date format that will be accepted by the Drupal Database as it gives me errors on trying to save the nodeObject.

daniel37smp’s picture

_Data = new Object();
_Data.field_q_contact = new Array({uid:"6"});
ws.node.save(_Data);

(mx.messaging.messages::ErrorMessage)#0
body = (Object)#1
clientId = (null)
correlationId = "2FBFE0E5-3C8F-DF4B-5226-F386DFD2B8D3"
destination = ""
extendedData = (null)
faultCode = "AMFPHP_RUNTIME_ERROR"
faultDetail = "/home/piensama/public_html/sa/sites/default/modules/amfphp/amfphp.inc on line 74"
faultString = "Contact: found no valid user with that name."
headers = (Object)#2
messageId = "1F935277-353C-A880-7C6C-F386E3BFC478"
rootCause = (null)
timestamp = 0
timeToLive = 0

help please!!!!