You set the gateway URL in the RemoteObjectAMF0 "endpoint" attribute.
In the example that is located at "org.nevis.cairnogrom.samples.login.business.Services.mxml" Renaun --- In [email protected], William Lambé <[EMAIL PROTECTED]> wrote: > > Where did you put the two lines : > > > > var gatewayUrl:String = "http://localhost/flashservices/gateway.php"; > > gateway = new RemotingConnection( gatewayUrl ); > > > > Thanks, > > > > Will Trying. > > > > _____ > > De : [email protected] [mailto:[EMAIL PROTECTED] De la > part de Oriol Gual > Envoyé : lundi 27 mars 2006 15:06 > À : [email protected] > Objet : Re: [flexcoders] [Flex 2 beta 2 - Cairngorm 2 - AMFPHP] > > > > Hi Will, > > If you need a fast, but maybe not the best solution, you can do this: > > package com.example { > > import flash.net.Responder; > import org.nevis.cairngorm.commands.Command; > import org.nevis.cairngorm.control.CairngormEvent ; > > public class ExampleCommand implements Command { > > public function execute( event : CairngormEvent ) : void > { > var exampleEvent : ExampleEvent = ExampleEvent ( event ); > model.gateway.call( "service.method", new Responder(onResult, > onFault), arguments); > } > > public function onResult( event : Object ) : void > { > // Handle your result > } > > public function onFault( event : Object ) : void > { > //Handle your fault > } > > [Bindable] > public var model : ModelLocator = ModelLocator.getInstance(); > } > > } > This is working for me, except if I use value objects, then I get a > BadVersion error, if you find a solution let me know please. > > Oriol. > > 2006/3/27, William Lambé <[EMAIL PROTECTED]>: > > I am lost in the Cairngorm business folder : Services ? Delegate ? > > How to rewrite ServiceLocator.as ?... many questions. > > > > So I explain what I would like to do, and what I have tried : > > > > So my goal is to use AMFPHP, because I have only PHP on my Apache server > (not a specialist of server running with Flex Data Services, and so on). > > But I also want to use the Cairngorm architectural framework. I already > studied the framework (I read all your very very good articles on MM Devnet > Thank you !) and I understand ModelLocator, Value Objects, The Controller, > and the Commands that execute to Events from the user (or system) > > > > But when I begin to look how I could change the ServiceLocator .as (from > org.nevis.cairngorm.business), I make lots of fault I really need your > help. > > > > I already used AMFPHP with Flex, with a simple exemple, making like that, > and it works : > > > > ####### ActionScript Code in my main.mxml ####### > > [Bindable] > > public var PHPData:Array; > > import flash.net.Responder; > > public var gateway : RemotingConnection; > > > > var gatewayUrl:String = "http://localhost/flashservices/gateway.php"; > > gateway = new RemotingConnection( gatewayUrl ); > > gateway.call( "adminbapp.getStudents", new > Responder(onResultInit, onFaultInit)); > > > > public function onResultInit( result : Array ) : void > > { > > PHPData = result; > > } > > public function onFaultInit( fault : String ) : void > > { > > trace( fault ); > > } > > > > ####### RemotingConnection.as ####### > > > > package org.nevis.cairngorm.business > > { > > import flash.net.NetConnection; > > import flash.net.ObjectEncoding; > > public class RemotingConnection extends NetConnection > > { > > public function RemotingConnection( sURL:String ) > > { > > objectEncoding = ObjectEncoding.AMF0; > > if (sURL) connect( sURL ); > > } > > public function AppendToGatewayUrl( s : String ) : > void > > { > > // > > } > > // A améliorer : voir mailinglist amfphp > > } > > } > > > > ####### END CODE ###### > > > > And I would like to transfer that sample to the cairngorm framework. > > > > First I thought that I don't need anymore a ServiceLocator, because my > services are defined in MyService.php, with the methodTable from AMFPHP. So > I plan to code only the Business Delegate where I could define each call to > the services, like : > > > > ### CODE ### > > package org.nevis.cairngorm.samples.login.business > > { > > > > // import org.nevis.cairngorm.business.Responder; > > // import org.nevis.cairngorm.business.ServiceLocator; > > import org.nevis.cairngorm.business.RemotingConnection; > > import org.nevis.cairngorm.samples.login.vo.LoginVO; > > > > import flash.net.Responder; > > > > public class LoginDelegate > > { > > public function LoginDelegate( responder : Responder > ) > > { > > this.responder = responder; > > } > > > > //------------------------------------------------------------ > > > > public function checkLogin( loginVO : LoginVO ): > void > > { > > > > var gateway : RemotingConnection; > > var gatewayUrl:String = > "http://localhost/flashservices/gateway.php"; > > gateway = new RemotingConnection( > gatewayUrl ); > > var response = gateway.call( > "adminbapp.getStudents", (responder.onResult, responder.onFault )); > > response.loginVO = loginVO; > > > } > > > > //------------------------------------------------------------- > > > > private var responder:Responder; > > // private var service:Object; > > } > > > > } > > > > ### END CODE ### > > > > And then retrieve to thread the onResult and onFault in each Command, as you > said it is good practice. > > > > But it doesn't really work, and I have an error like > > « Implicit coercion of a value of type 'Function' to an unrelated type > 'flash.net:Responder' » to the line in red > > > > What must I change to this to correct the error, and better, if someone has > an idea how to code service locator (a little bit like the ARP Framework the > Aral Balkan maybe) ? > > > > Thank you so much. > > > > We could talk on the mailing list about what we tried, what doesn't work, > and so on > > > > Good Flex Work, > > > > William, Belgium. > > > > PS : I know it is not authorized to said 'URGENT' on the mailing list, but I > really need to run this for Thursday 8.30 am, so really I need you. Thanks > so much in advance. > > > > > > _____ > > De : [email protected] [mailto:[EMAIL PROTECTED] De la > part de Steven Webster > Envoyé : lundi 27 mars 2006 13:49 > À : [email protected] > Objet : RE: [flexcoders] [Flex 2 beta 2 - Cairngorm 2 - AMFPHP] > > > > Just to back up Alex's excellent email here..... > > > > When Cairngorm used to be used for Flash-based RIA we would use Flash > Remoting, Open AMF, etc with success. If you do a search on > www.richinternetapps.com (or search my previous emails on Flexcoders) you'll > find a reference to the ActionScript 2.0 Dictionary where Alistair McLeod > and I posted an email link to the PDF chapter we wrote about this. > > > > Back in those days, the ServiceLocator was an ActionScript class, that > handled all the complexities associated with creating NetConnections/etc > that you assume responsibility for when descending to the detail of Flash > Remoting. > > > > When working with Flex-based RIA, it's typical to ascend the foodchain > towards RemoteObejct, WebService and HTTPService (though not necessary) and > so we made the decision in Cairngorm that the ServiceLocator be an MXML > implementation, that could allow Flex to do all the heavy-lifting with the > RPC Service tags. That way, we didn't have to worry ourselves anymore with > NetConnections, and Java object serialisations/etc. > > > > However, if you want to use AMFPHP, you can do what many others have done, > you can ensure that your ActionScript service locator is able to return > these services. You want to hide all the details of service creation and > lookup in the ServiceLocator so that your business delegate is immune to the > implementation. > > > > I know others have done this already ... but if you can share your solution > with us, we can ensure that others can leverage from your findings. > > > > If you have any more questions, please don't hesitate to ask. > > > > Best, > > > > Steven > > > > > > > > Steven Webster > Practice Director (Rich Internet Applications) > Adobe Consulting > Westpoint, 4 Redheughs Rigg, South Gyle, Edinburgh, EH12 9DQ, UK > p: +44 (0) 131 338 6108 > > m: +44 (0) 7917 428 947 > > > > > > Alex Uhlmann > Sent: 26 March 2006 11:57 > To: [email protected] > Subject: RE: [flexcoders] [Flex 2 beta 2 - Cairngorm 2 - AMFPHP] > > Hi William, > > > > usually, you would define the AMFPHP interface in Services.mxml, retrieve it > via ServiceLocator from your Delegate. But ServiceLocator can only return > you either mx.rpc.AbstractService or mx.rpc.http.HTTPService (for Flex2 's > out of the box RPC services). However you could create the AMFPHP specific > details in your Delegate. But better would be to add a method to Cairngorm's > ServiceLocator that either returns a generic object or an object compatible > to AMFPHP (RemotingConnection or NetConnection). Let me know how you get on. > > > > Best, > > Alex > > > > > > > > Alex Uhlmann > Consultant (Rich Internet Applications) > Adobe Consulting > Westpoint, 4 Redheughs Rigg, South Gyle, Edinburgh, EH12 9DQ, UK > p: +44 (0) 131 338 6969 > > m: +44 (0) 7917 428 951 > [EMAIL PROTECTED] > > > > > > > > > _____ > > > From: [email protected] [mailto: > <mailto:[email protected]> [EMAIL PROTECTED] On Behalf > Of William Lambé > Sent: 25 March 2006 22:10 > To: [email protected] > Subject: [flexcoders] [Flex 2 beta 2 - Cairngorm 2 - AMFPHP] > > Hello guys, > > > > Did someone try to use Cairngom (architectural framework for flex) with > AMFPHP ? > > > > I ask because I don't see clearly (in the sample Cairngorm Login) how to > change LoginDelegate and Services.mxml to use it with AMFPHP (for exemple > where to introduce the RemotingConnection of Tweenpix ( > <http://www.tweenpix.net/blog/index.php?2006/01/03/543-hello-world-en-amfphp > -avec-flex20> > http://www.tweenpix.net/blog/index.php?2006/01/03/543-hello-world-en-amfphp- > avec-flex20 )) > > > > If you tried one time, coud you explain us please. > > > > Thank you, > > > > William. > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > > > > > > > SPONSORED LINKS > > > Web site design development > <http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+site > +design+development&w2=Computer+software+development&w3=Software+design+and+ > development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=1 > 66&.sig=L-4QTvxB_quFDtMyhrQaHQ> > > Computer software development > <http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=Web+si > te+design+development&w2=Computer+software+development&w3=Software+design+an > d+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s > =166&.sig=lvQjSRfQDfWudJSe1lLjHw> > > Software design and development > <http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=Web+ > site+design+development&w2=Computer+software+development&w3=Software+design+ > and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5 > &s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ> > > > Macromedia flex > <http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+deve > lopment&w2=Computer+software+development&w3=Software+design+and+development& > w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6n > PIrz7_EpZI36cYzBjw> > > Software development best practice > <http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1=W > eb+site+design+development&w2=Computer+software+development&w3=Software+desi > gn+and+development&w4=Macromedia+flex&w5=Software+development+best+practice& > c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw> > > > > > > _____ > > YAHOO! GROUPS LINKS > > > > * Visit your group "flexcoders > <http://groups.yahoo.com/group/flexcoders> " on the web. > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms > <http://docs.yahoo.com/info/terms/> of Service . > > > > _____ > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > > > > > SPONSORED LINKS > > > Web > <http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+site > +design+development&w2=Computer+software+development&w3=Software+design+and+ > development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=1 > 66&.sig=L-4QTvxB_quFDtMyhrQaHQ> site design development > > Computer > <http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=Web+si > te+design+development&w2=Computer+software+development&w3=Software+design+an > d+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s > =166&.sig=lvQjSRfQDfWudJSe1lLjHw> software development > > Software > <http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=Web+ > site+design+development&w2=Computer+software+development&w3=Software+design+ > and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5 > &s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ> design and development > > > Macromedia > <http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+deve > lopment&w2=Computer+software+development&w3=Software+design+and+development& > w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6n > PIrz7_EpZI36cYzBjw> flex > > Software > <http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1=W > eb+site+design+development&w2=Computer+software+development&w3=Software+desi > gn+and+development&w4=Macromedia+flex&w5=Software+development+best+practice& > c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw> development best practice > > > > > > _____ > > YAHOO! GROUPS LINKS > > > > * Visit your group "flexcoders > <http://groups.yahoo.com/group/flexcoders> " on the web. > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > * Your use of Yahoo! Groups is subject to the Yahoo! > <http://docs.yahoo.com/info/terms/> Terms of Service. > > > > _____ > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

