Anyone familiar with Flex Data Services knows about services-config.xml.
This file usually contains security constraint definitions, channel definitions, and logging settings that each of the services can use. (more here)
It’s one of those config files that always feels more complicated than it needs to be, and to top it off, it’s a compile-time resource. This limits its flexibility, especially when it comes to channel definitions.
Why should you have to recompile your application whenever your channel definitions change? Let’s declare them in AS3 instead!
Here’s an example of two channel definitions from a services-config.xml file:
Now let’s look at the same two channel definitions in AS3:
At first glance this code doesn’t appear to offer any advantage over the channels defined in services-config.xml. However in the AS3 code, the server name for the channels is passed in as a flashVar to the application.
This allows your application to determine at runtime which channels to use, and it also eliminates the need to compile the XML file into your application.
Two wins in my book.
Addendum: Adding Channel Definition Timeouts