R – Simplifying Flex deployments in services-config.xml

apache-flexflashherokuremotingweborb

I am using Flex/Flash to build a UI which front-ends my Rails server application. I am using WebORB as the communication mechanism. My question should apply beyond just WebORB, however. (I think).

Specifically, it has to do with the services-config.xml file. I have a local (laptop) dev environment, a remote dev and a remote production environment. I am sick of editing the URL in the services-config.xml file, rebuilding and deploying every time I want to test in a different environment.

Does anyone have any ideas on how to do this? I thought I could do the following:

   <channel-definition id="supremacy" class="mx.messaging.channels.AMFChannel">
        <endpoint uri="/weborb" class="flex.messaging.endpoints.AMFEndpoint"/>
        <properties>
            <polling-enabled>true</polling-enabled>
        </properties>
    </channel-definition>

By setting the URI="/weborb" and giving it a relative path, I figured it would work. And it does–locally–but it doesn't when I deploy it to my remote dev and prod environments (Heroku). Weird.

Best Answer

You could simplify the process somewhat by building your project with Ant. For example, you could create separate services-config.xml files for each environment and then have separate build scripts to compile for the different environments, choosing the appropriate config file automatically.