views:

485

answers:

3

Hi there:

I'm sure there's a simple explanation for this, but I haven't had much luck at finding the answer yet, so I figured I'd put the word out to my colleagues, as I'm sure some of you've run into this one before.

In my (simple) dev environment, I'm working with a handful of WCF Web Services, imported into my FB3 project and targeting a local instance of the ASP.NET development Web server. All good, no problems -- but what I'd like to know now is, What's the right way to deploy this project to test, staging and production environments? If my imported proxies all point, say, to http://localhost:1234/service.svc (from which their WSDLs were imported), and all I'm deploying is a compiled SWF, does Flex Builder expect me to "Manage Web Services > Delete", "> Add", recompile and release ever time I want to move my compiled Flex project from development to test, and to staging, and ultimately into production? Is there a simpler workflow for this?

Thanks in advance -- hope my question was clear.

Cheers, Chris

A: 

If you have path names which will change depending on the enviroment then you will likely need to recompile for each environment since these will be compiled in the swf.

I typically use ANT scripts to handle my compile/deployment process when moving from development and production environments. This gives me the ability to dynamically change any path names during the compile. These build files can be integrated into Flex Builder making this process very easy once you have everything set up, and can be done with one click or scheduled.

Brett
A: 

Thanks Brett. I've been meaning to dig into automating my build processes anyway, so now's probably as good a time as any. :)

Christian Nunciato
A: 

You do not need to build a SWF for each environment. Here's a technique I use commonly:

  1. Externalize your configuration properties into an XML file; in this case, it could be a URL for each service or a base URL used by all your services
  2. When the application starts up, make an HTTPService call to load the XML file, parse it, and store your properties onto some bindable "configuration object"
  3. Bind the values from that object against your objects that depend on the URLs
  4. Dispatch an event that indicates your configuration is complete. If you have some kind of singleton event dispatcher used by some components in your app, use that, so that the notification is global
  5. Now proceed with the rest of the initialization of your application

It takes a little work to orchestrate your app such that certain parts won't initialize until steps 1-5 take place. However I think it's good practice to handle a lot of this initialization explicitly rather than in constructors or various initialize or creationComplete events for components. You may need to reinitialize things when a user logs out and a different user logs in; if you already have your app set up to that initialization is something you can control then reinitialization will not be a problem.

cliff.meyers