google-code-backups / sabreamf

Automatically exported from code.google.com/p/sabreamf
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

I can't use NetConnection way to call php functions #12

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Write a simple getaway.php like this:

<?php
require_once 'SabreAMF/CallbackServer.php';
require_once 'include/services/HelloService.php';

function myCallback($serviceName, $methodName, $arguments) {
    // You can use the servicename to lookup and instantiate a service class
    $serviceObject = new $serviceName;
    if (!is_array( $arguments)) {
        $arguments = array($arguments);
    }
    // check the php manual if you don't know what this function does
    return call_user_func_array(array($serviceObject, $methodName),
$arguments);
}

// First we'll create the server object
$server = new SabreAMF_CallbackServer();
// setup the callback
$server->onInvokeService = 'myCallback';
// parse the request and spit out the response
$server->exec();
?>

2. Add one function in HelloService

public function sayHello($x){
        return $x;
    }

3.  Use Netconnection way in flex client to connect gateway and call function.

private var netConnection:NetConnection;

private function init():void{
            netConnection = new NetConnection();
          netConnection.connect("http://localhost:8888/sabre/gateway.php");

netConnection.addEventListener(NetStatusEvent.NET_STATUS,function(e:NetStatusEve
nt):void{
                    trace("e")
            })
              netConnection.call("HelloService.say",new
Responder(resultFunction,faultFunction),"hello")
}

What is the expected output? What do you see instead?

I always get error "NetConnection.Call.BadVersion" when do call, 
RemoteObject way is fine. 

What version of the product are you using? On what operating system?

SabreAMF-1.3.234 on Leadpard 10.5.7

Please provide any additional information below.

Original issue reported on code.google.com by Kevin.Lu...@gmail.com on 7 Sep 2009 at 5:06

GoogleCodeExporter commented 8 years ago
Hi Kevin,

This script will expect a class named HelloService, with a method named 'say'. 
Do you
have this?

If you're getting a BadVersion error, it means that PHP is throwing an error. 
It can
sometimes be difficult to find out what the details of the PHP error was, so you
should check your error log (or make sure it's turned on).

The error log _should_ tell you the exact error.

Original comment by evert...@gmail.com on 7 Sep 2009 at 11:38

GoogleCodeExporter commented 8 years ago

Original comment by evert...@gmail.com on 7 Sep 2009 at 6:51