Setting up multiple channel types (AMF/AMFX) for Flex/BlazeDs
- by Fergal
We've configured our Flex client to have two channels for calling our services via BlazeDS.
One channel is configured to use AMFChannel and the other for HTTPChannel. Here's the services-config.xml
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/data/messagebroker/amf"
class="flex.messaging.endpoints.AMFEndpoint" />
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
<channel-definition id="my-amfx" class="mx.messaging.channels.HTTPChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/data/messagebroker/amfx"
class="flex.messaging.endpoints.HTTPEndpoint" />
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
Our flex client is written to use either AMF or AMFX depending on how we configure it. The problem is that although the client can switch between channels it sends an AMF binary payload when attempting to call services via AMFX (expecting XML).
The funny thing is that we can write services-config.xml to use either AMF or AMFX individually but Flex doesn't seem to want to let us use both.
Is this a bug in Flex? If not how can we get it to use the correct protocol?