[flexcoders] Re: AMFPHP, OpenAMF or Fluorine or FES

2006-03-21 Thread mvbaffa
Hi Michael,

I have just downloaded Flex 2 Beta 2. I will put it to work. I tell 
you after if this is working with Beta 2

Thank you very much 

--- In flexcoders@yahoogroups.com, Michael Schmalle 
[EMAIL PROTECTED] wrote:

 Hey,
 
 I am using Flex2-AMFPHP in a project and it works great!
 
 There has been some discussion in this list about what to change by
 subclassing NetConnection.
 
 Well hey, here is my stuff;
 
 package com.teotigraphix.amf
 {
 import flash.net.NetConnection;
 
 public class NetConnection2 extends NetConnection
 {
 public function AppendToGatewayUrl
(append:String):void
 {
 }
 
 public function AddHeader():void
 {
 }
 
 public function ReplaceGatewayUrl():void
 {
 }
 }
 }
 
 Service abstract class
 
 package com.teotigraphix.amf
 {
 import flash.util.trace;
 
 import flash.net.Responder;
 import flash.net.NetConnection;
 import flash.net.ObjectEncoding;
 
 import flash.events.Event;
 import flash.events.EventDispatcher;
 
 import mx.utils.ObjectUtil;
 
 import com.teotigraphix.amf.NetConnection2;
 
 import com.teotigraphix.events.FaultEvent;
 import com.teotigraphix.events.ResultEvent;
 
 /**
  * The abstract class to create a concrete service 
implementation using
 AMFPHP.
  * @author Michael J. Schmalle
  * @date 03-06-06
  */
 public class AMFService extends EventDispatcher
 {
 protected var _gateway:NetConnection2;
 private var __gatewayURL:String = 
 http://localhost/teotigraphix/flashservices/gateway.php;;
 protected var classPath:String = ;
 
 /**
  * The url leading to the service's gateway.php file.
  * @usage myService.gatewayURL = 
 http://www.example.com/flashservices/gateway.php;;
  */
 public function set gatewayURL(value:String):void
 {
 __gatewayURL = value;
 }
 public function get gatewayURL():String
 {
 return __gatewayURL;
 }
 
 /**
  * Create the gateway connection, set ObjectEncoding to 
AMF0 and
 connect the gateway to the gateway url.
  * @see com.teotigraphix.amf.NetConnection2
  */
 public function AMFService()
 {
 super();
 _gateway = new NetConnection2();
 _gateway.objectEncoding = ObjectEncoding.AMF0;
 _gateway.connect(__gatewayURL);
 }
 
 /**
  * NOTE :: This works but it needs to have the arguments 
dealt with,
 so I didn't implement it yet.
  * Can anyone tell me what I am doing wrong to get the 
arguments
 passed to php correctly ?
  * Wrapper for the fudged service call.
  * @param methodName a string indicating the method to 
invoke within
 this service.
  * @param responder a Responder instance that will 
activate the
 default onResult() or onFault() handlers.
  */
 protected function service(methodName:String, 
responder:Responder,
 ... args):void
 {
 //trace(service()  + classPath + . + methodName);
 _gateway.call(classPath + . + methodName, responder, 
args);
 }
 
 //
 
=
===
 // Public _gateway event handlers
 //
 
=
===
 
 /**
  * Default result handler for the Responder.
  * @param event an Event that holds {event.result}.
  */
 public function onResult(event:Object):void
 {
 dispatchEvent(new ResultEvent(result, event));
 }
 
 /**
  * Default fault handler for the Responder.
  * @param event an Event that holds {event.fault}.
  */
 public function onFault(event:Object):void
 {
 //trace(onFault(), ObjectUtil.toString(event));
 dispatchEvent(new FaultEvent(fault, event));
 }
 }
 }
 
 Subclassed service...
 
 
 
 package com.teotigraphix.amf.files
 {
 import com.teotigraphix.amf.AMFService;
 
 import com.teotigraphix.events.ResultEvent;
 import flash.net.Responder;
 import flash.util.trace;
 import com.teotigraphix.amf.files.IFileService;
 
 public class AMFFileService extends AMFService implements 
IFileService
 {
 
 public function AMFFileService()
 {
 super();
 classPath 
= com.teotigraphix.amf.files.AMFFileService;
 }
 
 /**
  *
  */
 public function getAllDirectories(directory:String):void
 {
 var responder:Responder = new Responder
(onAllDirectories,
 onFault);
 //service(getAllDirectories, responder, directory);

[flexcoders] Re: AMFPHP, OpenAMF or Fluorine or FES

2006-03-21 Thread mvbaffa
I have read your code and there is a comment about: 
service(methodName:String, responder:Responder, ... args)

Well I had some problems with the rest argument ... args in another 
class. I used another construction it worked. 

Instead of passing a list of arguments I pass an object set like 
this:

args = new Object();
args.argument1 = value1;
args.argument2 = value2;
service(methodName, responder,args);

Well it worked for me to call a webservice. The ... args was 
swapping the arguments and this solved the problem.

I hope this help you


--- In flexcoders@yahoogroups.com, Michael Schmalle 
[EMAIL PROTECTED] wrote:

 Hey,
 
 I am using Flex2-AMFPHP in a project and it works great!
 
 There has been some discussion in this list about what to change by
 subclassing NetConnection.
 
 Well hey, here is my stuff;
 
 package com.teotigraphix.amf
 {
 import flash.net.NetConnection;
 
 public class NetConnection2 extends NetConnection
 {
 public function AppendToGatewayUrl
(append:String):void
 {
 }
 
 public function AddHeader():void
 {
 }
 
 public function ReplaceGatewayUrl():void
 {
 }
 }
 }
 
 Service abstract class
 
 package com.teotigraphix.amf
 {
 import flash.util.trace;
 
 import flash.net.Responder;
 import flash.net.NetConnection;
 import flash.net.ObjectEncoding;
 
 import flash.events.Event;
 import flash.events.EventDispatcher;
 
 import mx.utils.ObjectUtil;
 
 import com.teotigraphix.amf.NetConnection2;
 
 import com.teotigraphix.events.FaultEvent;
 import com.teotigraphix.events.ResultEvent;
 
 /**
  * The abstract class to create a concrete service 
implementation using
 AMFPHP.
  * @author Michael J. Schmalle
  * @date 03-06-06
  */
 public class AMFService extends EventDispatcher
 {
 protected var _gateway:NetConnection2;
 private var __gatewayURL:String = 
 http://localhost/teotigraphix/flashservices/gateway.php;;
 protected var classPath:String = ;
 
 /**
  * The url leading to the service's gateway.php file.
  * @usage myService.gatewayURL = 
 http://www.example.com/flashservices/gateway.php;;
  */
 public function set gatewayURL(value:String):void
 {
 __gatewayURL = value;
 }
 public function get gatewayURL():String
 {
 return __gatewayURL;
 }
 
 /**
  * Create the gateway connection, set ObjectEncoding to 
AMF0 and
 connect the gateway to the gateway url.
  * @see com.teotigraphix.amf.NetConnection2
  */
 public function AMFService()
 {
 super();
 _gateway = new NetConnection2();
 _gateway.objectEncoding = ObjectEncoding.AMF0;
 _gateway.connect(__gatewayURL);
 }
 
 /**
  * NOTE :: This works but it needs to have the arguments 
dealt with,
 so I didn't implement it yet.
  * Can anyone tell me what I am doing wrong to get the 
arguments
 passed to php correctly ?
  * Wrapper for the fudged service call.
  * @param methodName a string indicating the method to 
invoke within
 this service.
  * @param responder a Responder instance that will 
activate the
 default onResult() or onFault() handlers.
  */
 protected function service(methodName:String, 
responder:Responder,
 ... args):void
 {
 //trace(service()  + classPath + . + methodName);
 _gateway.call(classPath + . + methodName, responder, 
args);
 }
 
 //
 
=
===
 // Public _gateway event handlers
 //
 
=
===
 
 /**
  * Default result handler for the Responder.
  * @param event an Event that holds {event.result}.
  */
 public function onResult(event:Object):void
 {
 dispatchEvent(new ResultEvent(result, event));
 }
 
 /**
  * Default fault handler for the Responder.
  * @param event an Event that holds {event.fault}.
  */
 public function onFault(event:Object):void
 {
 //trace(onFault(), ObjectUtil.toString(event));
 dispatchEvent(new FaultEvent(fault, event));
 }
 }
 }
 
 Subclassed service...
 
 
 
 package com.teotigraphix.amf.files
 {
 import com.teotigraphix.amf.AMFService;
 
 import com.teotigraphix.events.ResultEvent;
 import flash.net.Responder;
 import flash.util.trace;
 import com.teotigraphix.amf.files.IFileService;
 
 public class AMFFileService extends AMFService implements 
IFileService
 {
 
 public function