Re: [flexcoders] Re: Confused by context.root, services-config.xml and remoting-config.xml...
> Now when I run the app I get a "Destination 'MyService' has no > channels defined and the application does not define any default > channels." That sounds like a server configuration problem. My guess is that you have a 'destination' set up in your remoting- config.xml that isn't specifying a channel., and that there is no default channel element in your remoting-config file. The usual set up is something like: You can also specify channels on a per-destination basis. You need to make sure that whatever is in the "ref" attribute of the channel tags corresponds to one of the channel-definition's set up in your services-config.xml file, so in the above, you must have a channel with id="my-amf" present. Hope this is of some use. Stephen
RE: [flexcoders] Re: Confused by context.root, services-config.xml and remoting-config.xml...
But you're still assigning the mService.channelSet property with your programmatically created ChannelSet, right? -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of lawriegallardo Sent: Monday, November 19, 2007 3:28 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Confused by context.root, services-config.xml and remoting-config.xml... As suggested, I removed the endpoint property from my mx:RemoteObject tag, removed the services property from my mxmlc Ant task and did a clean, build, deploy. Now when I run the app I get a "Destination 'MyService' has no channels defined and the application does not define any default channels." Any thoughts? Cheers, Lawrie
Re: [flexcoders] Re: Confused by context.root, services-config.xml and remoting-config.xml...
> Do I still need to worry about the services-config.xml and > remote-config.xml files? If not, how do the destinations and their > properties (i.e. the source property that specifies which Java service > gets called) get set up? The various *-config.xml file in the WEB-INF directory are used by the server to determine how to map an incoming request to a piece of server side code. Your remote object calls will specify one of the destinations listed in the config file (remoting-config.xml, perhaps, I don't have an FDS install to hand at the moment I'm afraid), when Flex sends the request this is sent along with it, at the server the' gateway', which is a servlet the url of which you specify as the remote object 'endpoint'', receives the call and uses the information in the config files to figure out which method to call on which object - remoting-config.xml essentially just maps the 'destination' name that flex sends to a class on the server. So, as a Flex developer you just have to make sure the server is running and that the any java class or jar files can be found by the server, and that you know the correct destination names to use in your RemoteObjects. What can cause confusion is that if in Flex Builder you specify a data services server when create the project then Flex Builder uses the config information on the server to automatically set endpoints on remote objects (IIRC you can specify a server-config file to mxmlc to achieve the same thing). This creates a dependency on the server against which you are building 'against' in flex builder, so when you come to deploy in another environment you find you're stuck as endpoint information has been baked into your swf by Flex Builder. You then have to go into your Flex code and add all the endpoints you thought you'd got away without having to worry about : \ Stephen.
RE: [flexcoders] Re: Confused by context.root, services-config.xml and remoting-config.xml...
For the MXML RemoteObject API, it's true there is an endpoint property and what steve writes about it automatically selecting the right channel based on HTTP(S) URLs is correct, but it is not marked bindable and I've not seen it used with MXML binding statements. So, I am suggesting that while you're trying to get this to work - just use the programmatic approach you're using with ChannelSet exclusively for now. Pete -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of lawriegallardo Sent: Monday, November 19, 2007 1:52 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Confused by context.root, services-config.xml and remoting-config.xml... No, we're not at crossed purposes at all - that's really useful thanks! Do I still need to worry about the services-config.xml and remote-config.xml files? If not, how do the destinations and their properties (i.e. the source property that specifies which Java service gets called) get set up? Cheers, Lawrie --- In flexcoders@yahoogroups.com, "Stephen Allison" <[EMAIL PROTECTED]> wrote: > > > Thanks for your help - Apologies if I'm being a bit thick , but I'm > > a not quite sure what you mean when you say that you "set the > > endpoint property of the RemoteObject to point at whatever AMF > > endpoint url you want". Could you clarify this a bit, please? > > Hi, > RemoteObject defines an endpoint property which allows you to > programatically set the AMF endpoint used by that instance. So: > > var ro:RemoteObject = new RemoteObject(...); ro.endpoint = > Application.application.parameters["gatewayUrl"] > > and you're ready to go, the RemoteObject will use either a secure AMF > channel or a regular AMF channel depending on whether or not the url you > provide it is https or not. > > You can probably (and I've not checked) set it in mxml using data binding: > endpoint={Application.application.parameters['gatewayUrl']} ...> > > or somesuch. We set gatewayUrl from FlashVars in the containing ASP page, > so the server decides which endpoint a given application talks to. > > Apologies if we're at crossed purposes here! > > Stephen > -- 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
RE: [flexcoders] Re: Confused by context.root, services-config.xml and remoting-config.xml...
If you're programmatically creating a ChannelSet then I wouldn't use the endpoint attribute as that might override what you're doing. Also, if you're only using RPC services like RemoteObject and you're creating ChannelSets, then you don't need to compile against a services-config.xml. Other than that, I'd modify your code to look to see whether the URL was HTTPS or not so that you'd create a SecureAMFChannel instead of an AMFChannel. -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of lawriegallardo Sent: Monday, November 19, 2007 11:46 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Confused by context.root, services-config.xml and remoting-config.xml... Hi Peter, Thanks for your reply. The answer is yes to all your questions. This is the code I used: public function init():void { var amfChannel:AMFChannel = new AMFChannel("my-amf", getContextRootUrl() + "/messagebroker/amf"); amfChannel.pollingEnabled = false; var myChannelSet:ChannelSet = new ChannelSet(); myChannelSet.addChannel(amfChannel); myService.channelSet = myChannelSet; } private function getContextRootUrl():String { var i:int = Application.application.url.lastIndexOf("/"); var contextRootUrl:String = Application.application.url.substring(0, i); return contextRootUrl; } ... Can you see any possible issues? I'm still using the same services and compiler.context-root properties for mxmlc, and I haven't amended my services-config.xml, so it still has the following channel definition: http://{server.name}:{server.port}/{context.root}/messagebroker/amf " class="flex.messaging.endpoints.AMFEndpoint"/> false Do I need to change any of this? Cheers, Lawrie --- In flexcoders@yahoogroups.com, "Peter Farland" <[EMAIL PROTECTED]> wrote: > > > If you host your SWF inside the same WAR that hosts the remoting > service, then you should be able to programmatically create a > ChannelSet of Channels that is based on the URL that was used to load > the SWF (at runtime you could look at the value of > mx.core.Application.application.url). Did you create a ChannelSet and > add your AMFChannel to that and then set that on your RemoteObject? > > > > -Original Message- > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] > On Behalf Of lawriegallardo > Sent: Monday, November 19, 2007 10:46 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Confused by context.root, services-config.xml > and remoting-config.xml... > > Hi, > > I've got an application that uses LCDS RemoteObjects and this worked > fine as a development build - I used the Ant mxmlc task and configured > the services and compiler.context-root properties to point at my > development LCDS web-app and everything was dandy. > > However, when I tried to rename my web-app it stopped working... After > some googling I discovered that using {context.root} in your > services-config.xml and building with Flex Builder or mxmlc > effectively hard-codes the endpoint urls for your services into your swf file. > > This is an issue for me because I need to be able to do is compile my > app once, but then be able to be able copy this app for different > clients (i.e. each client will have a separate copy of the application > - Client1 will access the app via www.mycomp.com/myapp/client1, > Client2 will access the app via www.mycomp.com/myapp/client2, etc). > > I've tried creating an AMFChannel in my client code and setting this > as the channel for my mx:RemoteObjects, but this doesn't seem to work. > I'm guessing I might also need to amend my services-config-xml file to > get this to work??? > > If anyone can shed any light on this it would be greatly appreciated. > > Thanks, > > Lawrie > > > > -- > 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 > -- 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