flex blazed 配置多个remoting-config


我把配置贴出来,大家如果有类似需求可以参考下:

remoting-config-1.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service-1"
    class="flex.messaging.services.RemotingService">

    <adapters>
        <adapter-definition id="java-object"
            class="flex.messaging.services.remoting.adapters.JavaAdapter"
            default="true" />
    </adapters>
   
    <default-channels>
        <channel ref="my-amf" />
    </default-channels>

    <destination id="userService">
        <properties>
            <source>com.qihu.service.UserService</source>
        </properties>
    </destination>
</service>

remoting-config-2.xml配置

<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service-2"
    class="flex.messaging.services.RemotingService">

    <adapters>
        <adapter-definition id="java-object"
            class="flex.messaging.services.remoting.adapters.JavaAdapter"
            default="true" />
    </adapters>

    <default-channels>
        <channel ref="my-amf" />
    </default-channels>

    <destination id="customService">
        <properties>
            <source>com.qihu.service.CustomService</source>
        </properties>
    </destination>
</service>

services-config.xml配置:

<?xml version="1.0" encoding="UTF-8"?>
<services-config>

   <services>
       <service-include file-path="remoting-config-1.xml" />
       <service-include file-path="remoting-config-2.xml" />
       <service-include file-path="proxy-config.xml" />
       <service-include file-path="messaging-config.xml" />       
   </services>

应用程序:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:RemoteObject id="user" destination="userService"/>
<mx:RemoteObject id="custom" destination="customService"/>
    <mx:Label x="280" y="325" width="160" text="{user.testByUser.lastResult}"/>
    <mx:TextInput id="userInput" x="280" y="295" change="user.testByUser(userInput.text)"/>
    <mx:Label x="480" y="325" width="160" text="{custom.testByCustom.lastResult}"/>
    <mx:TextInput id="customInput" x="480" y="295" change="custom.testByCustom(customInput.text)"/>
</mx:Application>

你可能感兴趣的:(xml,Flex)