【问题标题】:Flash RemoteObject Weborb connection without services-config.xml (no Flex)没有 services-config.xml 的 Flash RemoteObject Weborb 连接(没有 Flex)
【发布时间】:2009-11-12 12:34:13
【问题描述】:

上下文:我正在开发一个使用 FDT 开发并使用 Flash CS4 编译的 Flash 应用程序(我需要一个庞大的库)。它应该连接到各种 Weborb 服务。

Weborb 已正确配置。我的服务通过管理控制台正确执行并返回值。 Weborb 示例以及使用 Flex 编译的各种测试功能齐全。

问题: 当我尝试调整代码以使用 Flash 编译并像这样设置远程对象时:

var remoteObject = new RemoteObject();
remoteObject.destination = "GenericDestination";
remoteObject.source = "MyServices.MyService";
remoteObject.addEventListener("fault", onFault);
remoteObject.getFoo.addEventListener("result", onResult);

我得到以下错误:

faultCode: InvokeFailed
faultString: '[MessagingError]'
faultDetail: 'null'

如果我尝试以这种方式设置频道:

var channelSet:ChannelSet = new ChannelSet();
var amfChannel:AMFChannel = new AMFChannel("my-amf",
    "http://localhost/weborb/weborb.php");
channelSet.addChannel(amfChannel);

var remoteObject = new RemoteObject();
remoteObject.channelSet = channelSet;
remoteObject.destination = "MyServices/MyService";

然后我得到了这个错误:

faultCode: Client.Error.MessageSend
faultDetail: Channel.Connect.Failed
url: 'null'

问题:如何正确设置 RemoteObject 以从使用 Flash 编译的 Flash 应用程序连接到 Weborb 远程服务?

这让我发疯了。

【问题讨论】:

    标签: flash actionscript rpc weborb remoteobject


    【解决方案1】:

    我正在使用此代码以编程方式配置RemoteObject

    var channelSet:ChannelSet = new ChannelSet();
    var channel:Channel = new AMFChannel("my-amf", "http://localhost/weborb/weborb.php");
    channelSet.addChannel(channel);
    
    var ro:RemoteObject = new RemoteObject("SomeCustomDestination");
    ro.source = "Full.Class.Name.With.Namespace";
    ro.channelSet = channelSet;
    
    // invoking service
    var op:AbstractOperation = ro.getOperation("SomeCustomMethod");
    op.addEventListener(ResultEvent.RESULT, onResult);
    op.send(params);
    

    SomeCustomDestination 定义在WEB-INF/flex/services-config.xml 中,这是服务器需要的,但客户端需要识别它才能访问。服务器可能会为您的目的地发布访问策略(安全约束)。

    【讨论】:

      【解决方案2】:

      这是我不久前的post。也许这会有所帮助。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-01-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-01-30
        相关资源
        最近更新 更多