--- In flexcoders@yahoogroups.com, "valdhor" <valdhorli...@...> wrote: > > Basically, you want to create a destination in the services- config.xml > file that points to your server. Something like: > > <endpoint uri="http://www.example.com/flex2gateway/" > class="flex.messaging.endpoints.AMFEndpoint"/> > > Also, make sure you have compiler settings set for for this. Something > like -locale en_US -services "services-config.xml"
You might also want to consider just using a remote object you've created entirely in actionscript. That way, if something changes you don't have to recompile the project. Something like this: package com.rw.adBlankenship.remoting { import mx.messaging.Channel; import mx.messaging.ChannelSet; import mx.messaging.channels.AMFChannel; import mx.rpc.AsyncToken; import mx.rpc.Responder; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.remoting.RemoteObject; public class GetProfileCount { private static var _ro:RemoteObject=new RemoteObject (); private static var _channels:ChannelSet=defaultChannelSet(); //sets up default channel set private static function defaultChannelSet():ChannelSet { return new ChannelSet; } //allows channels to be added from anywhere in the application public static function set endpoint (gateway:String):void { var channel:AMFChannel; //look to see if the channel is already there for (var i:int=0; i<_channels.channels.length; i++){ channel=_channels.channels[i]; if (channel.endpoint==gateway) return; } //add channel channel = new AMFChannel('pcChannel'+i, gateway); _channels.addChannel(channel); } public static function get endpoint():String{ return Channel(_channels.channels [_channels.channels.length-1]).endpoint; } /* Execute method. If calling object passes in result and fault handlers, those are used. Otherwise, the defaults are used. */ public static function execute(categoryID:int=-1, searchString:String=null, resultHandler:Function=null, faultHandler:Function=null):void{ if (_channels.channels.length==0) { throw new Error('No endpoint specified for GetCategories command Remote Object'); } //set up remote object _ro.channelSet=_channels; _ro.destination = 'AMF_Category'; _ro.source = 'AMF_Category'; //set up a token so we can tell the result of this call from other calls var token:AsyncToken=_ro.getServicesCount (categoryID>-1?categoryID: null, searchString); //assign the result and fault handlers from the calling object token.addResponder(new Responder(! (resultHandler==null)?resultHandler:countLoaded, ! (faultHandler==null)? faultHandler: loadFailed)); } /* trace out the return since we don't know where to put it */ private static function countLoaded (e:ResultEvent):void{ trace(e.result.toString() + ' profiles'); } private static function loadFailed(e:FaultEvent):void{ trace(e.fault); } }//end of class }