package com.ericfeminella.rpc
{
import mx.rpc.remoting.RemoteObject;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.IResponder;
/**
*
* Provides a generic base class API for creating Weborb PHP
* gateway connections and performing RPC based invocations
* on remote PHP objects.
*
*/
public class WebORBPHPRemoteGateway extends RemoteObject implements IResponder
{
/**
*
* Instantiates a new instance of WeborbRemoteGateway
* and Iniatializes the destination for the remote PHP
* object as specified via remoting-config.xml
*
* @param destination as defined in remoting-config.xml
*
*/
public function WebORBPHPRemoteGateway(destination:String)
{
this.destination = destination;
}
/**
*
* Performs RPC method invocation on a remote PHP object
* and adds result and fault listeners to the call
*
* @param the method to invoke on the remote object
* @param a parameter of arbitrary length
*
*/
public function invoke(method:String, ...args):void
{
this[method].addEventListener( ResultEvent.RESULT, result );
this[method].addEventListener( FaultEvent.FAULT, fault );
this[method].send.apply( null, [].concat(args) );
}
/**
*
* Handles an asynchronous result response
*
* @param the data object associated with the result
*
*/
public function result(data:Object) : void
{
var result:ResultEvent = data as ResultEvent;
}
/**
*
* Handles an asynchronous fault response
*
* @param the info object associated with the fault
*
*/
public function fault(info:Object) : void
{
var fault:FaultEvent = info as FaultEvent;
}
}
}