I almost finished my project but now I want to add a dynamic server url setting in each view. Application bootstraps with config.xml and channels-config.xml (I used Parsley framework ).
config.xml:
<?xml version="1.0" encoding="utf-8"?>
<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:services="services.*">
<fx:Declarations>
<services:GenBUS id="genBUS"/>
<services:KarBUS id="karBUS"/>
<services:UygBUS id="uygBUS"/>
</fx:Declarations>
</fx:Object>
channels-config.xml:
<objects
xmlns="http://www.spicefactory.org/parsley"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.spicefactory.org/parsley
http://www.spicefactory.org/parsley/schema/2.4/parsley-core.xsd">
<object type="mx.messaging.ChannelSet">
<property name="channels">
<array>
<object type="mx.messaging.channels.AMFChannel">
<property name="uri" value="http://localhost:8080/ClinASM/messagebroker/amf"/>
</object>
</array>
</property>
</object>
</objects>
The scenario is as follows: User will change url before logging into a system, and when all is done the updated endpoint url will be kept in SessionClientData.endpoint, and before the method on the server-side is called I do assign a new endpoint to Remote Object class:
[Inject(id="genBUS")]
public var genBUS:GenBUS;
public function login(username: String, password:String):void {
//updating endpoint
genBUS.endpoint = SessionClientData.endpoint;
//call responder is created and..
loginViewResponder.token = genBUS.getLoginResult(username,password);
}
But I'm doing something wrong - so that it's not working... Any suggestions how to make a dynamic & easy to construct channels config?
UPDATE: How to reconfigure the structure so that there'll be no "services" remote objects on clients side - I don't want to update Flex Server section each time - as in some cases there will be unreachable servers just as in my case now... Any tutorial or example configuration on this?