利用RemoteObject动态调用 FluorineFx 的服务器方法???

mygisforum 2011-12-26 05:51:37
1.使用<mx:RemoteObject/> 调用一切正常


<mx:RemoteObject id="service" destination="fluorine"
source="FlexNet.ServiceLibrary.Sample">
<mx:method name="Echo" result="onResult(event)">
</mx:method>
</mx:RemoteObject>
service.Echo(txtInput.text);




2.使用 RemoteObject 总是报错:
错误信息:customOperationHandleFault: faultCode:Server.Processing faultString:'Failed to locate the requested type *' faultDetail:'null'

var remoteOperation:RemoteObject = new RemoteObject();
remoteOperation.destination = "fluorine";
//remoteOperation.endpoint= "http://localhost:2747/Web/Gateway.aspx";
var op0:AbstractOperation = remoteOperation.getOperation("Echo" );

op0.addEventListener(ResultEvent.RESULT,customOperationHandleResult);
op0.addEventListener(FaultEvent.FAULT,customOperationHandleFault);

op0.arguments = "adag";
op0.send();



服务器方法:

namespace FlexNet.ServiceLibrary
{
/// <summary>
/// Fluorine sample service.
/// </summary>
[RemotingService("Fluorine sample service")]
public class Sample
{
public Sample()
{
}

public string Echo(string text)
{
return "Gateway echo: " + text;
}
}
}


配置文件:services-config.xml

<?xml version="1.0" encoding="utf-8" ?> 
<services-config>
<services>
<service-include file-path="remoting-config.xml" />
<!-- <service-include file-path="messaging-config.xml" /> -->
<!-- <service-include file-path="data-management-config.xml" /> -->
</services>

<!-- Custom authentication -->
<security>
<!-- A security constraint requires that a user is authorized before accessing a destination.
Here you can declare security constraints globally. When several destinations
use the same security settings, you should define one security constraint in the
security section of the services configuration file and refer to it in each destination.
-->
<!--
<security-constraint id="privileged-users">
<auth-method>Custom</auth-method>
<roles>
<role>admin</role>
<role>privilegeduser</role>
</roles>
</security-constraint>
-->

<!--
Custom login command, to check a user's credentials and log a principal into the application server
A login command must implement the com.TheSilentGroup.Fluorine.Messaging.Security.ILoginCommand interface
or inherit from com.TheSilentGroup.Fluorine.Messaging.Security.GenericLoginCommand.

You can use a login command without security constraints defined.
-->
<!--
<login-command class="FluorineFx.Security.GenericLoginCommand" server="asp.net"/>
-->
</security>

<channels>
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint uri="http://{server.name}:{server.port}/{context.root}/Gateway.aspx" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<!-- <legacy-collection>true</legacy-collection> -->
</properties>
</channel-definition>
<!--
<channel-definition id="my-rtmp" class="mx.messaging.channels.RTMPChannel">
<endpoint uri="rtmp://{server.name}:2037" class="flex.messaging.endpoints.RTMPEndpoint"/>
<properties>
<idle-timeout-minutes>20</idle-timeout-minutes>
</properties>
</channel-definition>
-->
</channels>
</services-config>


救命呀,郁闷了一个下午,还是没有搞定,自杀的心都有了!!!
...全文
280 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xkx12 2012-03-22
  • 打赏
  • 举报
回复
mygisforum 2011-12-26
  • 打赏
  • 举报
回复
关键是参数格式搞错了,极度郁闷呀。闪人1
mygisforum 2011-12-26
  • 打赏
  • 举报
回复
靠,脑袋太混了,无语。。。满足下面两条即可

var remoteOperation:RemoteObject = new RemoteObject();
remoteOperation.destination = "fluorine";
remoteOperation.source = "FlexNet.ServiceLibrary.Sample";// 1.服务忘记写了
var op0:AbstractOperation = remoteOperation.getOperation("Echo" );

op0.addEventListener(ResultEvent.RESULT,customOperationHandleResult); op0.addEventListener(FaultEvent.FAULT,customOperationHandleFault);

op0.arguments = ["adag"];//2.参数格式搞错了
op0.send();


4,328

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计 Flex
社区管理员
  • Flex
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧