- Indice foros de discusión - :: subflash.com :: Portal dedicado al desarrollo de aplicaciones web con ActionScript
FAQFAQ   BuscarBuscar   MiembrosMiembros   Grupos de UsuariosGrupos de Usuarios   RegistrarseRegistrarse   PerfilPerfil   Entre para ver sus mensajes privadosEntre para ver sus mensajes privados   LoginLogin 

                     
Ir a
Foros de discusión -> - Flash Communication Server (FlashCom), Flash Remoting + amfphp

Carro de Compras - de http://www.flash-db.com newstore

 
Publicar nuevo tema    Responder al tema
Ver tema anterior :: Ver tema siguiente  
Autor Mensaje
flecoria
Recién incorporado
Recién incorporado



Registrado: 02 Jul 2009
Mensajes: 6
Mensaje Publicado: Vie Jul 03, 2009 12:11 am  Responder al tema Responder citando
Hola a todos,

He instalado el newstore de http://www.flash-db.com en mis servidores,

con Wamp: apache2.2.11 ; mysql 5.1.33 ; php 5.2.9.2

configurado las bases de datos y importado las tablas todo parece estar bien
de primera instancia funciona correctamente,

pero en la opcion de las familias las toma bien, pero al elegir alguna siempre sigue en la misma , muestra solo 8 fotos, y ademas cuando cargo alguna al carro paso a la seccion de los datos del cliente y ya no me toma dichos datos ni con el demo@demo.com ni ingresando nuevos clientes este es el shopping.php que uso:

Código:


<?php
include_once("inc_sql.php");
class shopping
{
   var $dbhost = HOSTNAME;
   var $dbname = DATABASE;
   var $dbuser = USERNAME;
   var $dbpass = PASSWORD;


   function shopping()
   {
      $this->methodTable = array(
         "getFamily" => array(
            "description" => "Returns avaible Family of products",            
            "access" => "remote", // available values are private, public, remote
            "returntype" => "recordSet"
         ),
         "getProducts" => array(
            "description" => "Returns avaible products of a Family",
            "access" => "remote", // available values are private, public, remote
            "arguments" => array ("Id"),
            "returntype" => "recordSet"
         ),
         "getClient" => array(
            "description" => "Returns info of an existent client",
            "access" => "remote", // available values are private, public, remote
            "arguments" => array ("Email", "Password"),
            "returntype" => "recordSet"
         ),
         "checkClient" => array(
            "description" => "Check that the client is unique",
            "access" => "remote", // available values are private, public, remote
            "arguments" => array ("Email")
         ),
         "insertClient" => array(
            "description" => "Inserts a new client",
            "access" => "remote", // available values are private, public, remote
            "arguments" => array ("Client")
         ),
         "updateClient" => array(
            "description" => "Updates info from a client",
            "access" => "remote", // available values are private, public, remote
            "arguments" => array ("Id", "Client")
         ),
         "insertOrder" => array(
            "description" => "Inserts a new order",
            "access" => "remote", // available values are private, public, remote
            "arguments" => array ("ClientID", "Total", "Shipping")
         ),
         "insertDetail" => array(
            "description" => "Inserts a Details of an order",
            "access" => "remote", // available values are private, public, remote
            "arguments" => array ("OrderID", "List") // List is an array with two slots ->"FkProduct" and -> "Qty"
         ),
         "sendMail" => array(
            "description" => "Send an email with details of an order",
            "access" => "remote", // available values are private, public, remote
            "arguments" => array ("ClientID", "OrderID")
         )
      );
       // Initialize db connection

            $this->conn = mysql_pconnect($this->dbhost, $this->dbuser, $this->dbpass);
            mysql_select_db ($this->dbname);
   }
   function getFamily()
   {
      return mysql_query("SELECT * FROM Family");
   }

   function getProducts($Id)
   {
      return mysql_query("SELECT * FROM Products where FkFamily='".$Id."'");
   }
   function getClient($Email, $Password)
   {
      return mysql_query("SELECT * FROM Clients where Email='".$Email."' AND Password='".$Password."'");
   }
   function checkClient($Email)
   {
      $result = mysql_query("SELECT * FROM Clients where Email='".$Email."'");
      return mysql_num_rows($result);
   }
   function insertClient($Client)
    {   
     //Build Date
     $Month =($Month<9)?"0".$Month:$Month;
     $date = $Year."-".$Month."-00";
     //Insert query
        $result = mysql_query("Insert into Clients(PkClient, Email, Password, Name, Address, City, State, Country, Phone, Credit_Card, Credit_Number, Expiration)
      values('', '".$Client['Email']."', '".$Client['Pass']."', '".$Client['Name']."', '".$Client['Address']."', '".$Client['City']."', '".$Client['State']."', '".
         $Client['Country']."', '".$Client['Phone']."', '".$Client['CreditCard']."', '".$Client['CreditNumber']."', '".$Client['Expiration']."')");
      if($result) return mysql_insert_id($this->conn);
      else return "error";
    }
   function updateClient($Id, $Client)
    {
     //Build Date
     $Month =($Month<9)?"0".$Month:$Month;
     $date = $Year."-".$Month."-00";
     //Update query
        $result = mysql_query("Replace into Clients (PkClient, Email, Password, Name, Address, City, State, Country, Phone, Credit_Card, Credit_Number, Expiration)
      values('".$Id."', '".$Client['Email']."', '".$Client['Pass']."', '".$Client['Name']."', '".$Client['Address']."', '".$Client['City']."', '".$Client['State']."', '".
         $Client['Country']."', '".$Client['Phone']."', '".$Client['CreditCard']."', '".$Client['CreditNumber']."', '".$Client['Expiration']."')");
      if(!mysql_error()) return $Id;
      else return "error";      
    }
   function insertOrder($ClientID, $Total, $Shipping)
   {      
      $result = mysql_query("Insert into Orders values('', '".$ClientID."', '".$Total."', '".$Shipping."', NOW())");
      if($result) return mysql_insert_id($this->conn);
      else return "error";
   }
   function insertDetail($OrderID, $List) // List is a two dimensional array with FkProduct and Quantity
   {   
      for ($i=0; $i<sizeof($List); $i++)
      $result = mysql_query("Insert into Details values('".$OrderID."', '".$List[$i]['Pk']."', '".$List[$i]['Qty']."')");            
      if(mysql_error()) return "error";
      else return $OrderID;
   }
   function sendMail($ClientID, $OrderID)
   {
      //Select client
      $result = mysql_query("Select Name, Email from Clients where PkClient='".$ClientID."'");
      $client = mysql_fetch_array($result);      
      //Select pedido
      $result = mysql_query("Select Total, Shipping from Orders where PkOrder='".$OrderID."'");
      $pedido = mysql_fetch_array($result);
      //Select details
      $result = mysql_query("Select Qty, Name, Price from Details left join Products on FkProduct=PkProduct where FkOrder='".$OrderID."'");
      //Build the message
      $message ="Dear $client[Name] :\n\nWe have processed your submission with these details:\n\n";
      while($row=mysql_fetch_array($result)) $message .="- $row[Name] Qty: $row[Qty] U/price: $row[Price]\n";
      $total = $total = sprintf("%01.2f", $pedido[Total]);
      $message .="Total: $total\n\nThanks for buying in our Site\nPlease if you have any question, write to customers@mysite.com\n\n";
      //Send email
      if(mail($client[Email], "Demo e-commerce", $message, "From: Demo e-commerce <AMFPHP Flash>"))
      return "Message sended";
      else return "error";      
   }      
}
?>



Gracias por el carro esta barbaro, espero me puedan dar alguna ayuda con mi problema
Saludos!!
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor MSN Messenger
jorge
Moderador
Moderador



Registrado: 27 Oct 2002
Mensajes: 1759
Ubicación: Rosario - Bs As - Madrid
Mensaje Publicado: Lun Jul 06, 2009 4:11 pm  Responder al tema Responder citando
¿Lo tienes colgado en un servidor que podamos ver?

Jorge
_________________
http://www.aulacreactiva.com
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor
flecoria
Recién incorporado
Recién incorporado



Registrado: 02 Jul 2009
Mensajes: 6
Mensaje Publicado: Mie Jul 08, 2009 1:13 am  Responder al tema Responder citando
Hola Jorge,

No lo tengo en prueba en un servidor wamp en mi compu,

Igualmente en el servidor de www.flash-db.com, el demo tampoco cambia las imagenes al cargar las distintas familias, o sea tambien son las mismas fotos:

http://www.flash-db.com/Tutorials/newstore/index.php, pero en este si funciona las consultas de clientes y clientes nuevos al llenar los formularios,
que es lo que en mi compu con el wamp no me funciona, sera porque se tiene que subir a un servidor en la web?

Gracias por la respuesta.

Nicolas
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor MSN Messenger
jorge
Moderador
Moderador



Registrado: 27 Oct 2002
Mensajes: 1759
Ubicación: Rosario - Bs As - Madrid
Mensaje Publicado: Mie Jul 08, 2009 12:36 pm  Responder al tema Responder citando
Ok, gracias por hacerme notar que las imágenes no cambiaban. En efecto, al cambiar de PHP 4.x a PHP 5 el servidor, la clase de Remoting que estaba sobre la biblioteca vieja funcionaba mal, ya lo arreglé, ahora ya cambian las imágenes de nuevo en el demo de flash-db
Con respecto a tu caso, te recomiendo que uses Charles http://www.charlesproxy.com para ver que están devolviendo las llamadas al gateway

Jorge
_________________
http://www.aulacreactiva.com
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor
flecoria
Recién incorporado
Recién incorporado



Registrado: 02 Jul 2009
Mensajes: 6
Mensaje Publicado: Mie Jul 08, 2009 1:52 pm  Responder al tema Responder citando
Ok, Gracias por la pronta respuesta, lo voy a probar y luego te comento como me fue.

Gracias nuevamente.

Nicolas
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor MSN Messenger
flecoria
Recién incorporado
Recién incorporado



Registrado: 02 Jul 2009
Mensajes: 6
Mensaje Publicado: Jue Jul 09, 2009 8:37 pm  Responder al tema Responder citando
Jorge,

Cuando me comentaste :

"al cambiar de PHP 4.x a PHP 5 el servidor, la clase de Remoting que estaba sobre la biblioteca vieja funcionaba mal, ya lo arreglé, ahora ya cambian las imágenes de nuevo en el demo de flash-db "

Me podrias guiar cual fue el cambio con respecto al codigo;

Por otro lado instale el www.charlesproxi.com, lo estoy probando y por lo que puedo entender las respuestas de los archivos son correctas.

Este es mi gateway:
Código:

<?php
   //default gateway
    include ("./app/Gateway.php");
   
    $gateway = new Gateway();
    $gateway->setBaseClassPath("./services/");
    $gateway->service();

?>


y este es mi GateWay:

Código:

<?php

define("AMFPHP_BASE", dirname(dirname(__FILE__)) . "/");

require_once(AMFPHP_BASE."io/AMFInputStream.php");
require_once(AMFPHP_BASE."io/AMFDeserializer.php");
require_once(AMFPHP_BASE."app/Executive.php");
require_once(AMFPHP_BASE."io/AMFSerializer.php");
require_once(AMFPHP_BASE."io/AMFOutputStream.php");
require_once(AMFPHP_BASE."exception/Exceptions.php");
require_once(AMFPHP_BASE."util/AMFObject.php");
require_once(AMFPHP_BASE."util/Authenticate.php");

class Gateway
{
    var $exec; // The executive object
    var $debugdir = "../dump/"; // The default location of the debugging dump directory
    var $deserializer; // The deserializer object
    var $amfin; // The input stream object
    var $amfout; // The output stream object
    var $service_browser_header = "DescribeService"; // The amf header used by the service browser
   var $credentials_header = "Credentials"; // The amf header used to set credentials
    var $callback_header = "/onResult"; // The string flash expects from a successful method call
    var $amf_header = "Content-type: application/x-amf"; // The value of the HTTP content header expected by Flash

   /**
    * Constructor method initializes the Executive class and initializes the global method index property
    * for proper error reporting
    *
    */
   function Gateway()
   {
      $GLOBALS['_lastMethodCall'] = "/1";
      $this->exec = new Executive();
   }
   
    /**
     * The service method runs the gateway application.  It turns the gateway 'on'.  You
     * have to call the service method as the last line of the gateway script after all of the
     * gateway configuration properties have been set.
     *
     * Right now the service method also includes a very primitive debugging mode that
     * just dumps the raw amf input and output to files.  This may change in later versions.
     * The debugging implementation is NOT thread safe so be aware of file corruptions that
     * may occur in concurrent environments.
     *
     */
    function service()
    {
        global $debug;
        if ($debug) {
            $this->_saveRawDataToFile ($this->debugdir."input.amf", $GLOBALS["HTTP_RAW_POST_DATA"]);
        }
       
      $inputStream = new AMFInputStream($GLOBALS["HTTP_RAW_POST_DATA"]); // wrap the raw data with the input stream
        $deserializer = new AMFDeserializer($inputStream); // deserialize the data
        $amfin = $deserializer->getAMFObject(); // grab the deserialized object
        $amfout = new AMFObject(); // create a new amfobject to store the output
       
      $headercount = $amfin->numHeader(); // count the number of header
        for ($i=0; $i<$headercount; $i++) { // loop over the headers
            $header = $amfin->getHeaderAt($i); // get the current header
            if ($header['key'] == $this->service_browser_header) { // is this the service browser header
                $this->exec->addHeaderFilter($header); // tell the executive that
            } else if($header['key'] == $this->credentials_header){
            $this->exec->addHeaderFilter($header); // tell the executive that
         }
        }
       
        $bodycount = $amfin->numBody(); // get the body count
        for ($i=0; $i<$bodycount; $i++) {
            $body = $amfin->getBodyAt($i);
            $GLOBALS['_lastMethodCall'] = $body["response"]; // update the error call back indicator
            $this->exec->setClassPath($body["target"]); // set the class path
            $results = $this->exec->doMethodCall($body["value"]); // execute the method
            $returnType = $this->exec->getReturnType(); // get the declared return type
            $amfout->addBody($body["response"].$this->callback_header, "null", $results, $returnType); // add the item to the amf out object
        }
       
        $outstream = new AMFOutputStream(); // create an output stream wrapper
        $serializer = new AMFSerializer($outstream); // create the serializer
        $serializer->serialize($amfout); // serialize the amfout object

        if ($debug){
            $this->_saveRawDataToFile($this->debugdir."results.amf", $outstream->flush());
        }
      header($this->amf_header); // define the proper header
        print($outstream->flush()); // flush the binary data
    }
   /**
    * Setter for the debugging directory property
    *
    * @param dir    The directory to store debugging files.
    */
    function setDebugDirectory($dir)
   {
        $this->debugdir = $dir;
    }
   
    /**
     * Set an instance name for this gateway instance
     * Setting an instance name is used for restricted access to a gateway
     * If a gateway has an instance name, only service methods that have a matching instance
     * name can be used with the gateway
     *
     * @param    name    The instance name to bind to the gateway instance
     */
    function setInstanceName($name = "Instance1")
    {
        $this->exec->setInstanceName($name);
    }
   
    /**
     * Sets the base path for loading service methods.
     *
     * Call this method to define the directory to look for service classes in.
     * Relative or full paths are acceptable
     *
     * @param    path        The path the the service class directory
     */
    function setBaseClassPath($path)
    {
        $this->exec->setBaseClassPath($path);
    }
   
   /**
    * usePearSOAP is a method to disable the use of the PEAR::SOAP package.
    * This method should only be called if PEAR::SOAP is installed and the
    * preference is nuSoap.
    *
    * @param boolean Boolean whether to use the pear soap package
    */
    function usePearSOAP($bool = true)
    {
       $this->exec->usePearSOAP($bool);
    }
   
    /**
     * Dumps data to a file
     *
     * @param    filepath        The location of the dump file
     * @param    data            The data to insert into the dump file
     */
    function _saveRawDataToFile($filepath, $data)
    {
        if (!$handle = fopen($filepath, 'w')) {
             exit;
        }
        if (!fwrite($handle, $data)) {
            exit;
        }
        fclose($handle);
    }

    /**
     *    Appends data to a file
     *
     * @param    filepath        The location of the dump file
     * @param    data            The data to append to the dump file
     */
    function _appendRawDataToFile($filepath, $data)
    {
        if (!$handle = fopen($filepath, 'a')) {
             exit;
        }
        if (!fwrite($handle, $data)) {
            exit;
        }
        fclose($handle);
    }
   
    /**
     * Loads raw amf data from a file
     *
     * @param      filepath        The location of the dump file
     * @returns    The contents from the file
     */
    function _loadRawDataFromFile($filepath)
    {
        $handle = fopen($filepath, "r");
        $contents = fread($handle, filesize($filepath));
        fclose($handle);
        return $contents;
    }

    /**
     * Passes the content through to the appendRawDataToFile method
     *
     * @param    content    The content to append to the data file.
     */
    function debug($content) {
        $this->_appendRawDataToFile($this->debugdir."processing.txt",$content."\n");
    }
}
?>


Gracias
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor MSN Messenger
flecoria
Recién incorporado
Recién incorporado



Registrado: 02 Jul 2009
Mensajes: 6
Mensaje Publicado: Jue Jul 09, 2009 8:54 pm  Responder al tema Responder citando
Hola Jorge,

El charles me devuelve un fatal error al comunicarse con el executive.php en la linea 189 la cual es: (<br />
<b>Fatal error</b>: Cannot unset string offsets in <b>C:\wamp\www\flashservices\app\Executive.php</b> on line <b>189</b><br />)

unset($obj['_explicitType']);

y el codigo entero es :

Código:

<?php

class Executive
{
    var $_basecp = "services/"; // This is the directory "services/" relative to the gateway
    var $_classpath; // the classpath which is the path of the file from $_basecp
    var $_classname; // the string name of the class derived from the classpath
    var $_classConstruct; // the object we build from the class
    var $_methodname; // the method to execute in the construct
    var $_returnType=-1; // the defined return type
    var $_instanceName; // the instance name to use for this gateway executive
    var $services = array(); // the list with registered service-classes
    var $_incomingcp; // The original incoming classpath
    var $_origClassPath; // The original classpath
   var $_usePear = true; // Boolean determining if we default to use the pear soap module
    var $_headerFilters = array(); // switch to take different actions based on the headers
   var $_isWebServiceURI = false; // was the uri a web service?
   var $_webServiceURI;
   var $_webServiceMethod;
   var $_nusoapInstalled;
   var $_pearInstalled;
   
    /**
     * Executive constructor function
     */
    function Executive()
    {
      //nothing here
    }
   
    /**
     * Sets the header current amfheader name.
     * The executive will perform different actions depending on various
     * Headers passed by the remoting client
     *
     * @param header    A header string
     */
    function addHeaderFilter($header)
    {
        $this->_headerFilters[$header['key']] = $header;
    }
   
   /**
    * Sets the boolean usePear switch
    */
   function usePearSOAP($bool=true)
   {
      $this->_usePear = $bool;
   }
   
    /**
     * Sets the class path so the Executive will know where to find service class files
     *
     * @param basecp    The base class path directory
     */
    function setBaseClassPath($basecp)
   {
        $this->_basecp = $basecp;
    }
   
    /**
     * setInstanceName binds this gateway to a string
     * When this happens only services with a matching instance name
     * may be used with this gateway instance
     *
     * @ param    name    The instance name to bind to
     */
    function setInstanceName($name)
    {
        $this->_instanceName = $name;
    }
   
    /**
     * Through remoting you pass a . delimited path to the service class
     * without the extension.  This method translates that string into a real path
     *
     * @param cp    The full . delimited class path from the flash client
     */
    function setClassPath($cp)
    {
      if (strpos($cp, "http://") === false && strpos($cp, "https://") === false) { // check for a http link which means web service
         $this->_incomingcp = $cp;
         $lpos = strrpos($cp, ".");
         if ($lpos === false) {
            // throw an error because there has to be atleast 1
         } else {
            $this->_methodname = substr($cp, $lpos+1);
         }
         $trunced = substr($cp, 0, $lpos);
         $this->_origClassPath = $trunced;
         $lpos = strrpos($trunced, ".");
         if ($lpos === false) {
            $this->_classname = $trunced;
            $this->_classpath = $this->_basecp . $trunced.".php";
         } else {
            $this->_classname = substr($trunced, $lpos+1);
            $this->_classpath = $this->_basecp .str_replace(".", "/", $trunced) . ".php"; // removed to strip the basecp out of the equation here
            
         }
      } else { // launch a web service and not a php service
         $this->_isWebServiceURI = true;
         $rdot = strrpos($cp, ".");
         $this->_webServiceURI = substr($cp, 0, $rdot);
         $this->_webServiceMethod = substr($cp, $rdot + 1);
      }
    }

   /**
    *   negotiate whether the PEAR SOAP is installed, if not then if nuSOAP is installed.
    */
   function consumeWebService($a)
   {
      if ($this->_usePear) { // don't load PEAR::SOAP if it's not wanted.
                                    // There are also name space conflicts between the 2 packages.
         return $this->pearSoapImpl($a); // run the pear implementation   
      } else {
         return $this->nuSoapImpl($a); // run the nuSoap implementation
      }
   }
   
   /**
    * The nuSoap client implementation
    */
    function nuSoapImpl($a)
    {
      $this->_nusoapInstalled = @include_once(AMFPHP_BASE."lib/nusoap.php");
      if ($this->_nusoapInstalled) {
         $soapclient = new soapclient($this->_webServiceURI, true); // create a instance of the SOAP client object
         if (count($a) == 1 && is_array($a)) {
            $result = $soapclient->call($this->_webServiceMethod, $a[0]); // execute without the proxy
         } else {
            $proxy = $soapclient->getProxy();
            $result = call_user_func_array(array($proxy, $this->_webServiceMethod), $a);
         }
         return $result;
      } else {
         trigger_error("You must install a soap package, both PEAR::SOAP and nuSOAP are supported", E_USER_ERROR);
      }
    }
   
   /**   
   * The PEAR::SOAP client implementation
   */
   function pearSOAPImpl($a)
   {
      $this->_pearInstalled = @include_once "SOAP/Client.php"; // load the PEAR::SOAP implementation
      if ($this->_pearInstalled) {
         $client = new SOAP_Client($this->_webServiceURI);
         $response = $client->call($this->_webServiceMethod, $a);
         return $response;
      } else {
         $this->_usePear = false;
         $this->nuSoapImpl($a);
      }
   }
   
    /**
     * Returns the return type for the called remote method
     *
     * @returns        The defined return type from the service class's method table
     */
    function getReturnType()
    {
        return $this->_returnType;
    }

   
   /**
    *   filterCustomClassArguments takes the reference to the arguments property and
    * checks each argument to see if it has an _explicitType property, which means it was created
    * by the deserializer and should be passed through as an instance that custom class defined by the service
    *
    * @param object Reference to the passed arguments
    */
   function filterCustomClassArguments (&$a)
   {
      foreach($a as $argument => $obj) {
         if(isset($obj['_explicitType'])) {// get the name of the flash registered class and remove the label from the object
            $customclassname = $obj['_explicitType'];
            unset($obj['_explicitType']);
            if(class_exists($customclassname)) {
               // create instance of custom class in php
               // and add its properties from flash
               $customclass = new $customclassname();
               foreach($obj as $prop => $value) {
                  $customclass->$prop = $value;
               }
               // reset the argument as the new instance
               $a[$argument] = &$customclass;
            } else {
               // Probably better to pass anyway, and maybe send warning to NC Debug, if enabled
               // trigger_error("Custom Class " . $_customclassname . " does not exist", E_USER_ERROR);
            }
         }
      }
   }
   
   /**
    * loadServiceClass grabs the service class file
    */
    function loadServiceClass ()
    {
      $this->_calledMethod = $this->_methodname;
      $fileExists = @include_once($this->_classpath); // include the class file
      if($fileExists && class_exists($this->_classname)) { // Just make sure the class name is the same as the file name
         chdir(dirname($this->_classpath)); // change the cwd to the to the dir with the class
      } else { // Class not found exception
         trigger_error("no class named " . $this->_classname . " is known to the gateway", E_USER_ERROR);
      }
    }
   
   /**
    * extendServiceClass's job is to prepend the RemotingService name to the class name and actually package
    * the remoting service class so it's ready to be built
    */
   function extendServiceClass ()
   {
      $this->_finalclassname = "RemotingService_" . $this->_classname;  // append the class name to our RemotingService class
      if (!class_exists($this->_finalclassname)) { // only do this once
         $SuperClass = $this->_classname;
         include(AMFPHP_BASE."util/RemotingService.php");
         eval($RemotingSubClass); // evaluate the string as code
      }   
   }
   
   function handleHeaders ()
   {
      if (isset($this->_headerFilters['DescribeService'])) { // catch the Describe service header
         $this->_methodname = "__describeService"; // override the method name if one was sent
         $this->_classConstruct->methodTable[$this->_methodname]['instance'] = $this->_instanceName;
      }
      if(isset($this->_headerFilters['Credentials'])) // catch credentials service header
      {
         $credentials = &$this->_headerFilters['Credentials']['value'];
         if (method_exists($this->_classConstruct, "_authenticate")) {
            $roles = $this->_classConstruct->_authenticate($credentials['userid'], $credentials['password']);
            if ($roles !== false) {
               Authenticate::login($credentials['userid'], $roles);
            } else {
               Authenticate::logout();
            }
         } else {
            trigger_error("The _authenticate method was not found", E_USER_ERROR);
         }
      }   
   }
   
   function checkIfClassExists ()
   {
      if (!isset($this->_classConstruct->methodTable[$this->_methodname])) { // check to see if the methodTable exists
         trigger_error("Function " . $this->_calledMethod . " does not exist in class ".$this->_classConstruct.".",E_USER_ERROR);         
      }
   }
   
   function checkAccess ()
   {
      if (!isset($this->methodrecord['access']) || (strtolower($this->methodrecord['access']) != "remote")) { // make sure we can remotely call it
         trigger_error("Access Denied to " . $this->_calledMethod ,E_USER_ERROR);
      }
   }
   
   function handleAlias ()
   {
      if (isset($this->methodrecord['alias'])) { // see if it's an alias
         $this->_methodname = $this->methodrecord['alias'];
      }
   }
   
   function checkInstanceRestriction ()
   {
      if (isset($this->_instanceName)) { // see if we have an instance defined
         if ($this->_instanceName != $this->methodrecord['instance']) { // if the names don't match die   
            trigger_error("The method is not allowed through this restricted gateway!" ,E_USER_ERROR);
         }
      } else if (isset($this->methodrecord['instance'])) { // see if the method has an instance defined
         if ($this->_instanceName != $this->methodrecord['instance']) { // if the names don't match die   
            trigger_error("The restricted method is not allowed through a non-restricted gateway" ,E_USER_ERROR);
         }
      }
   }
   
   function checkRoles ()
   {
      if(isset($this->methodrecord['roles'])) {
         if(!Authenticate::isUserInRole($this->methodrecord['roles'])) {
            trigger_error("This user is not does not have access to " . $this->_methodname, E_USER_ERROR);
         }
      }
   }
   
   function handleReturnType ()
   {
      if (isset($this->methodrecord['returns'])) { // check to see if it specifies a return type
         $this->_returnType = $this->methodrecord['returns'];
      } else {
         $this->_returnType = -1;
      }
   }   
   
   function checkMethodDefinition ()
   {
      if (!method_exists($this->_classConstruct, $this->_methodname)) { // finally see if it is actually defined
         trigger_error("Function " . $this->_calledMethod . " does not exist in class ".$this->_classConstruct.".",E_USER_ERROR);
      }
   }
   
    /**
     * The main method of the executive class.
     *
     * @param    a    Arguments to pass to the method
     */
    function doMethodCall($a)
    {
      if ($this->_isWebServiceURI) {
         return $this->consumeWebService($a); // run the web service
      } else {
         $this->loadServiceClass(); // load the service class file
         $this->extendServiceClass(); // extend the service class
         $this->filterCustomClassArguments($a); // check for custom class arguments
         $this->_classConstruct = new $this->_finalclassname($this->_classname); // build the extended service class
         $this->_classConstruct->setClassPath($this->_origClassPath); // pass the class path
         $this->handleHeaders();
         $this->checkIfClassExists();
         $this->methodrecord =& $this->_classConstruct->methodTable[$this->_methodname]; // create a shortcut for the ugly path
         $this->checkAccess();
         $this->handleAlias();
         $this->checkInstanceRestriction();
         $this->checkRoles();
         $this->handleReturnType();
         $this->checkMethodDefinition();
         return call_user_func_array ( array(&$this->_classConstruct, $this->_methodname), $a); // do the magic
      }
    }
}
?>


Gracias
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor MSN Messenger
jorge
Moderador
Moderador



Registrado: 27 Oct 2002
Mensajes: 1759
Ubicación: Rosario - Bs As - Madrid
Mensaje Publicado: Lun Jul 13, 2009 11:54 am  Responder al tema Responder citando
Yep, ese error da con la versión amfphp vieja (es decir la que se usó en el tutorial)
Deberías instalar la última (1.9) que te puedes bajar de http://sourceforge.net/projects/amfphp/files/#files y hacer algunos cambios:

- El gateway ahora está en amfphp/gateway.php ... no hace falta que toques nada en gateway.php, es el mismo para todos tus servicios
- tienes que mover shopping.php e inc_sql.php a amfphp/services

That's it

Jorge
_________________
http://www.aulacreactiva.com
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor
flecoria
Recién incorporado
Recién incorporado



Registrado: 02 Jul 2009
Mensajes: 6
Mensaje Publicado: Lun Jul 13, 2009 2:56 pm  Responder al tema Responder citando
Buenisimo!!!!!!!!!!!!!!!!!!!!!!!!!

Muchas gracias por el tiempo y por la buena onda!!

Era eso nomas!!!

Saludos Cordiales!!!!!!!!!!!

Nicolas
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor MSN Messenger
Mostrar mensajes de anteriores:   
Publicar nuevo tema   Responder al tema    Foros de discusión -> - Flash Communication Server (FlashCom), Flash Remoting + amfphp Todas las horas son GMT + 1 Hora
Página 1 de 1

 
Cambiar a:  
Puede publicar nuevos temas en este foro
No puede responder a temas en este foro
No puede editar sus mensajes en este foro
No puede borrar sus mensajes en este foro
No puede votar en encuestas en este foro


Template/Skin (ChunkStyle) by ©Russellc (TheChunk.no-ip.com)
Best viewed in Mozilla Firefox 0.8
Powered by phpBB © 2001, 2002 phpBB Group