3 Replies Latest reply on Jun 15, 2009 7:54 AM by ethr

    override services-config at run-time

    ethr

      I have a large-ish module based project with scads of <mx:remoteobject> calls. Everytime I deploy Im having to (manually) change my services-config.xml to point my RPC to the release server followed by a clean build. Im wondering if its possible to override the settings in this file on a application-wide basis. IE when I start I'll look at the Application.application.url value to see if its the release or test server. Based on that value I'd like to set the RPC server destination.

       

      I see lots of samples on how to set this value on a call-by-call basis. I don't want to re-check my URL and (re)build a channel for every call if its possible update this value at runtime - once.

       

      Suggestions?

        • 1. Re: override services-config at run-time
          Michael Borbor Level 4

          If you create once your channel configuration, what would you need to

          recreate it over and over again if you could just use the same?

           

          You could also use the Spring ActionScript framework to do the config from

          an xml file instead of changing the file and then re-compiling your app.

           

          Although using a single bindable string var to a endPoint and then change

          this var value and recompile.

          • 2. Re: override services-config at run-time
            Muzak Level 3

            Use tokens (the default) instead of hardcoded urls.

            When using tokens, you don't have to change anything when switching servers/environments.

            • 3. Re: override services-config at run-time
              ethr Level 1

              As it stands now I have all my remote services declared in a separate file "remote-services.xml" that I include in the services-config.xml via a 'services' entry. Following this I have two 'channel-definition'   entries: one for test and one for release. I have been commenting out the one Im not using.

               

              Given that my 'default-channels' entry has one entry pointing to the 'channel-definition' above Im hoping that I can simpy replace the AMFChannel with a SecureAMFChannel pointing to the release server.

               

              Does that make any sense?

               

              I see where I can get the channel-definition entry using the ServerConfig.getChannel() call. Now how do I change this at run-time and save the new version so all my remote calls will use the new definition?

               

               

              Fixed: As it turns out I was able to use the existing setup of services-config.xml and remote-config.xml. In desperation I tried adding both the test and release servers into the 'default-channels' entry. It turns out that it fails-over v quickly. The test server isn't accessible from the release point so I put it first. Works fine.

               

              Message was edited by: ethr