Hi Everybody:

I pasted the code in the tutorial here to set up a service in Flash 8. It works fine when I change it for another Drupal Service. So Flash code is allright.
The problem is with my Drupal that doesn't send the data.
Is there something I'm missing.

So here is the code:

// Picking up a Drupal node with flash remoting
// Drupal must be set up with Services module enabled
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.debug.NetDebug;
import mx.utils.Delegate;

// expose debugging info to clientside "NetConnection debugger" utility
mx.remoting.debug.NetDebug.initialize();

// create, position, and set params on three dynamic text fields: status, node-title, and node-body
var tf:TextField = this.createTextField("status", 10, 0, 0, 200, 200);
var ntitle:TextField = this.createTextField("nodetitle", 11, 0, 50, 200, 200);
var nbody:TextField = this.createTextField("nodebody", 12, 0, 100, 200, 400);
ntitle.html = true;
ntitle.multiline = true;
nbody.html = true;
nbody.multiline = true;
nbody.wordWrap = true;

// establish connection with remote service gateway in Drupal and specify service
// - /services/amfphp is AMFPHP in Services gateway
// - node is one of the two default, exposed services in Services module. The other is view.
var gatewayUrl:String = "http://rffarias.net/services/amfphp";
var node:Service = new Service(gatewayUrl, new Log(), "node", null, null);
// call service method
// - load is one of three methods on the default node service
// - pass in which node to load (hard coded "1" here for node 1)
// - optional additonal param to node.load is what fields to return (like in a view?).
// -- array of field names: node.load(1, ['title', 'body']);
// -- default is to send the entire node. This example does that.
var pc:PendingCall = node.load(1);
// set up response handler functions
pc.responder = new RelayResponder(this, "getData_Result", "getData_Fault");

// set default status text
tf.text = "no response from server yet.";

// success result handler
function getData_Result( re:ResultEvent ):Void {
// re is the object containing the response
// two properties you can count on being populated for any node are re.result.title and re.result.body
tf.text = "response:";
ntitle.htmlText = "Node Title:
" + re.result.title;
nbody.htmlText = "Node Body:
" + re.result.body;
}

// failure result handler
function getData_Fault( fe:FaultEvent ):Void {
tf.text = "error";
}

But if you change the URL above it works and doesn't return the error. Just like for instance try another site that has a Flash example:

http://heliereric.com/drupal/services/amfphp

So if you paste the above URL in the code..it works fine.
I'm I missing some configuration?

Thanks
Gabriela

Comments

gabiroba’s picture

I tried to reinstall AMFPHP and I'm getting this error:

Fatal error: Cannot redeclare class AmfphpGateway in /home/rffarias/public_html/modules/amfphp/overrides/AmfphpGateway.php on line 6

any ideas?

Tks
Gabriela

snelson’s picture

First thought ... are you using the AMFPHP beta 2 available here? http://www.5etdemi.com/uploads/amfphp-1.9.beta.20070513.zip

Scott

gabiroba’s picture

Yes, I have set up everything all over again and I don't get this error anymore. But drupal still doesn't send the data.
So I went to check the NetConnection Debbuger and I have the following

"chdir () has been disabled for security reason"

So I tried to talk to my server and they say that they can't enable this service so I have to change my htaccess file.

The problem is I don't have a clue how to do that.

So if you have any suggestion on how to do that it would be great!

Many thanks for your previous answer.

Gabriela

gabiroba’s picture

Maybe it is very simple to solve this question by changing the host provider

JoachimVdH’s picture

can you try to see what the error message is in getdata_fault

with something like


for(var i:String in fe){
   tf.appendText("\n"+i+": "+fe[i]);
}


I used it in an example on http://drupal.org/node/177465

I had a long search finding out that i forget to turn on some services.

Joachim

JoachimVdH’s picture

Status: Active » Closed (fixed)