AMFPHP_RUNTIME_ERROR

DrplMG - February 20, 2009 - 17:29
Project:AMFPHP
Version:6.x-1.0-beta1
Component:Code
Category:support request
Priority:normal
Assigned:snelson
Status:active
Description

Hello I am using the following configuration :

amfphp 6.x-1.0-beta1
services 6.x-0.13

I have configured services module,permissions and api key but I got this error message as I try to connect by flash AS3 script :

DrupalSite: error while attempting to invoke Drupal service
description: Method system.connect does not exist.
code: AMFPHP_RUNTIME_ERROR
details: C:\Programmi\Apache Software Foundation\Apache2.2\htdocs\FlashDrupal\sites\all\modules\amfphp\amfphp.module
level: Unknown error type
line: 106

Any help appreciated thanx in advance Marco Gonnelli

#1

snelson - February 20, 2009 - 20:06
Category:bug report» support request
Priority:critical» normal
Assigned to:Anonymous» snelson

Enable system_service.module

#2

DrplMG - February 21, 2009 - 13:56

Sry forgot toI enable system_service.module.
thanx.
Marco

#3

robbertnl - March 24, 2009 - 13:01

I also got an AMFPHP runtime error:
fault: [RPC Fault faultString="Access denied." faultCode="AMFPHP_RUNTIME_ERROR" faultDetail="D:\Apache2.2\htdocs\drupal\sites\all\modules\amfphp\amfphp.module on line 106"]

The settings/modules i am using:
-method: node.get
-enabled services for nodes.
-disabled Use keys and Use sessid
-Services 6.x-1.x-dev
-AMFPHP 6.x-1.0-beta1 with AMFPHP 1.9 beta 2

#4

bluestarstudios - March 24, 2009 - 15:04

I'm getting the same original error ("Method <em>something.something</em> does not exist").
I have the system service enabled. What else am I doing wrong?

#5

robbertnl - March 27, 2009 - 14:13

I got it all working by following this tutorial: http://electricpineapple.net/?p=32

#6

bluestarstudios - March 30, 2009 - 04:25

Does anybody know of any tutorials how to make AMFPHP work with Flash CS3/CS4 (AS3)?

#7

Mershin - June 5, 2009 - 19:11

I was getting this error in Flash CS3(AS3).

I followed http://thanksfornotsuing.com/discussion/flash-integration-drupal-6

And then I was still getting AMFPHP_RUNTIME_ERROR line 106 (yes I had everything configured correctly).

I had Keys turned off, sessionIds turned on. I was able to 'trace' a SessionID that was returned, but when I called node.get, I got the runtime error.

Personally my problem in the end? I was trying to connect to www.domainname.com/services/amfphp while running the compiled swf from the flash IDE.

I turned on the debugger and saw that flash really does not like some sort of new security restriction involving master policy file. It's something like crossdomain.xml but not exactly? I did have a crossdomain.xml that allowed 'everything', but flash was ignoring it (The debug message actually said it was ignoring it). Anything flash player 9.0.124+ has this security requirement.

Once I uploaded my swf file to domainname.com, it pulled the node info correctly.

I imagine if you're running drupal on localhost, it should work?

A few things I had to double check:
- services/amfphp module enabled
- the services modules for node & service enabled (another set of modules included.)
- enabled sessionid but disabled keys in the services config.

I guess that's it.. latest versions of everything as of today, on drupal 6.

#8

libeco - June 12, 2009 - 18:53

I bought the book Flash in Drupal by Travis Tidwell and was following along chapter two which also shows a very basic way of loading Drupal data into Flash. I'm used to OO as I learned that at school, so I was using proper classes and was presented the same error. So I tried the example code from the book and again got the error. I have tried contacting Travis Tidwell through his site, with a link to this topic. I hope he has a solution, otherwise it seems like money thrown away for a book which shows code that doesn't work.

I was trying locally. I have tried loading the swf through localhost, but nothing was loaded.

I hope there's a solution to this problem...

#9

Mershin - June 16, 2009 - 01:45

I do have a working drupal/flash implementation...

This is the basics... (Using Flash CS4 IDE)

var drupal:NetConnection = new NetConnection();
drupal.objectEncoding=flash.net.ObjectEncoding.AMF3;
var sessionId:String;

drupal.connect( "http://www.sitename.com/services/amfphp");
drupal.call( "system.connect", new Responder(onConnect, onError ) );

function onConnect( result:Object ) {
sessionId=result.sessid;
trace(sessionId);
}

function onError( error:Object ) {
for each (var item in error) {
textfield.appendText(item);
}
}

If you get a sessionid outputted... then you're in business. If you can't get that far, then it's a configuration issue. Take a closer look at permissions section after you enable services & amfphp. I broke my brain getting it to work but hey when you have a deadline and you're on the 8th can of diet pepsi... something ends up working :p

If you got this far... I can get into node or views data.

I'm pulling 5 different content types of data into a flash interface with cck fields, including pictures being pulled/displayed, and the flash interface links to the drupal content. I have working code examples if you're this far.

#10

libeco - June 16, 2009 - 18:29

Thanks for helping. I do get the sessionID, also with the code from the book. But getting the node seems to be the problem for me.

This was my code as I got it from the book:

package {
import flash.display.MovieClip;
import flash.net.NetConnection;
import flash.net.Responder;
import flash.net.ObjectEncoding;

public class Main extends MovieClip {
var baseURL:String = "http://localhost/2009-06-12_drupaltest";
var gateway:String = baseURL + "/services/amfphp";
var drupal:NetConnection = new NetConnection();
var nodeId:Number = root.loaderInfo.parameters.node;
var responder:Responder = new Responder(onConnect, onError);
var sessionId:String = "";

public function Main() {
drupal.objectEncoding = ObjectEncoding.AMF3;
drupal.connect(gateway);
drupal.call("system.connect", responder);
}

function loadNode(nid:Number) {
var nodeResponse:Responder = new Responder(onNodeLoad, onError);
drupal.call("node.get", nodeResponse, sessionId, nid);
}

function onNodeLoad(node:Object) {
trace(node.title);
title.text = node.title;
}

function onConnect(result:Object) {
sessionId = result.sessid;
trace("connected");
trace("Session Id: " + sessionId);
loadNode(nodeId);
}

function onError(error:Object) {
for each(var item in error) {
trace(item);
}
}

} // End of class
} // End of package

*edit*
Actually, I just realised the opening poster is using Services 6.x-0.14, while I'm using Services 6.x-2.x-dev, don't know if that makes a difference?

#11

Mershin - June 17, 2009 - 17:51

hmm.. I have 6.x-0.13 installed. I think that may be your problem... dev version must be doing something different. Try 6.x-0.14?

This works on my install... it traced the title of the node.

var drupal:NetConnection = new NetConnection();
drupal.objectEncoding=flash.net.ObjectEncoding.AMF3;
var sessionId:String;

drupal.connect( "http://www.sitename.com/services/amfphp");
drupal.call( "system.connect", new Responder(onConnect, onError ) );

function onConnect( result:Object ) {
sessionId=result.sessid;
trace(sessionId);
loadNode();
}

function loadNode() {
var nodeResponse:Responder = new Responder(onNodeLoad, onError);
drupal.call("node.get", nodeResponse, sessionId, 24);
}

function onNodeLoad(node:Object) {
trace(node.title);
}

function onError( error:Object ) {
for each (var item in error) {
trace(item);
}
}

#12

libeco - June 17, 2009 - 19:57

I had some e-mail contact with the author of the book and he also said that I should use 0.14. I just tried with your code and it indeed works now, even on localhost.

Thanks!

#13

Mershin - June 18, 2009 - 16:35

No problem. Enjoy Flash & Drupal Integration. I'm having fun using views with arguments based on user input to pull subsets of data to display :)

#14

icarus313 - July 7, 2009 - 04:30

I'm hoping you solved this, and if so could offer some help.

I was following the tidwell Hello World exercise.

Initially, I had installed Services 6.x -0.14 , but after a couple hours of deactivating, reactivating, reinstalling, etc..
I found an issue posted by Tidwell himself. (still unresolved as of July 6th, 2009)
http://drupal.org/node/504526

Where the Keys won't show up....
So I had to install the Dev version 6.x-2.x-dev

At which point I was having the same issue as libeco

SessionID comes back no problem.
But trying to access node title I would get the error:
.....
Missing Required Arguments
106
AMFPHP_RUNTIME_ERROR
......

Since 0.14 permissions are set up different than 6.x-2.x-dev
I guessed at opening up what seemed like similar permissions as "access services"
System_service module
-check module exists from remote: (all three checked)
-get variable from remote: (all three checked)
-set variable from remote (all three checked)
see attached image.

this still didn't help.
It was only after I unchecked Use Keys, in the Services Settings.

Maybe it's me, and believe me it's me 99% of the time,
but I don't see passing the KEY in any of the code examples in book or in this thread?

has any one successfully retrieved the node.title, using version 6.x-2.x-dev and using both security methods, SessionId and KEY?

drewbe

that

AttachmentSize
servicePermissionsDev-1.jpg 31.2 KB

#15

icarus313 - July 7, 2009 - 04:36

The errata for the book pretty much answers my above question:
http://www.packtpub.com/view_errata/book/build-flash-applications-with-d...

Dev-services pack handles KEYs in different way, so using it you have to turn off KEYS.

icarus (drewbe_

#16

Mershin - July 21, 2009 - 14:09

hmm... only way I got it to work myself was with sessionIDs "on" but KEYS "off'. This is of course a security concern, but since my flash application only needed to "read" from Drupal, and not do anything that "could" be a security concern, that was ok for me.

Good to know the info from the above link since I was using 6.13 and 6.14 came out shortly after I started my project. Good thing I didn't update mid-project :)

 
 

Drupal is a registered trademark of Dries Buytaert.