我把配置贴出来,大家如果有类似需求可以参考下:
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>
分享到:
相关推荐
你可以使用 `<flex:remoting-destination>` 标签来配置服务的暴露,如下面的例子所示: ```xml <flex:remoting-destination ref="userService" endpoint="httpEndpoint" /> ``` 4. **配置 BlazeDS**:在 `...
在这个"ssh+flex+blazed"的集成过程中,我们主要涉及到以下几个关键知识点: 1. **SSH框架**: - **Spring**:提供依赖注入(DI)和面向切面编程(AOP),用于管理应用程序的组件和处理事务。 - **Struts**:是一...
- 使用`WEB-INF`文件夹中的配置文件,如`remoting-config.xml`。 - 将`WEB-INF`文件夹复制到Java项目的`WebRoot`目录下,替换原有的`WEB-INF`文件夹。 2. **创建Java类**: - 在Java项目中创建一个类,例如`...
3. **配置BlazeDS**:在Java项目中集成BlazeDS,配置相应的web.xml文件以启用BlazeDS服务,并在Flex项目中配置services-config.xml来指定与后端服务的连接。 4. **创建Spring服务**:使用Spring的注解或XML配置方式...
此外,编辑`remoting-config.xml`文件,定义目的地(destination),指明Java服务的源路径,例如`com.java.flex.FirstJavaFlex`。 #### 测试通信 为了验证Flex与Java的通信是否成功建立,可以编写一个简单的示例。...