views:

384

answers:

2

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.

A: 

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.

Stiggler
+1  A: 

You could configure your service on application startup (so based on a config file)

Create a channel with amfEndpoint as a string

var channelSet : ChannelSet = new ChannelSet();

var channel : NetConnectionChannel = null;

channel = new AMFChannel( "my-amf", amfEndpoint );

channelSet.addChannel( channel );

Give it to your remote object

ServiceLocator.getInstance().getRemoteObject( "myService" ).channelSet = channelSet;

CC
what would the services-config.xml look like for this?
HDave