views:

36

answers:

1

Hi all,

So as you may or may not know, BlazeDS (open source version of LiveCycle Data Services) is a nice way to get your server-side Java and client-side Flex application to play together. Unfortunately, it does have several pitfalls that need to be corrected. I'll try to explain one of them here.

All of BlazeDS's configuration is written via XML files in the flex/ folder of your webapp. The default names are separated for clarity, such as services-config.xml, remoting-config.xml, messaging-config.xml, etc. In these configuration files (particularly services-config.xml), Channels are defined; these setup URIs and objects used to capture and send information between the server and the client. In these config files, it is quite common to use a syntax like so:

    <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
        <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
        <properties>
            <add-no-cache-headers>false</add-no-cache-headers>
        </properties>
    </channel-definition>

Unfortunately, what they don't tell you is that some of these key-in replacements (ie: {context.root}) are not replaced dynamically upon execution but upon compilation of the WAR file you intend to distribute. Obviously not a good idea when switching domains.

So, instead I seek to dynamically define these channels. According to the documentation, that's all good and fine, but it only works if the channel already exists when the webapp is launched. I feel like that sort of defeats the point.

So my question is, how do you truly create channels dynamically so that both the client and the server recognize their existence?

A: 

Read this blog post; I believe it is what you're after.

I believe these xml config files have no direct relation to the server at all. They are used to tell the SWF how to find the server.

During Compile time of your Flex App; the services-config information is, in essence, hard coded into the SWF.

www.Flextras.com
Mmm, it helps a tad, but it's not quite there. What it allows me to do is dynamically get the `context.root`, but it doesn't at all explain about how to create endpoints on the server; Since I have to essentially hard-code the URI for endpoints into `services-config.xml`, I don't see how I can change around what the `context.root` is as far as the server knows.
duckworthd
Get your acceptance rate up a bit and maybe someone else will help.
www.Flextras.com