【问题标题】:When does flex throw NetConnection.Call.Badversion Errorflex 什么时候抛出 NetConnection.Call.Badversion 错误
【发布时间】:2010-11-11 11:18:41
【问题描述】:

我使用 Flex 作为我的客户端,使用 Java 作为我的服务器。在远程主机中使用 WebOrb。有时我会收到此错误。

故障代码:Client.Error.MessageSend
faultString:'发送失败'
faultDetail:'Channel.Connect.Failed 错误 NetConnection.Call.BadVersion::
网址:'http://foo.com:5480/bar/weborb.wo''

我不知道为什么会这样。我用谷歌搜索它并没有找到答案。 如果我在故障处理程序中处理它,一切正常。但我想知道为什么会这样。我应该怎么做才能避免这个错误。

任何帮助将不胜感激。

感谢您的回复..

这是我的抽象代码

public class FOOProxy implements IFOOProxy
{
    public static var FOO_PROXY:IFOOProxy;
    private var remote:RemoteObject;        

    public function FOOProxy()
    {

    }

    public function runCommand(request:IClientRequest):void
    {

        remote.addEventListener("result", onResult);
        remote.addEventListener("fault", onFault);          

      if(request is GeneralRequest)
        {
            var req:Request = request as CmdRequest ;
             if (req.requestType == fooController.UPDATE_REQUEST)
             {
                remote.requestTimeout=null;
             }else
             {
                remote.requestTimeout = 30;
             }                  
         }      
        remote.runCommand(request);

    }

    public function onResult(event:ResultEvent):void {
        var result:Object = (event as ResultEvent).result as Object ;
        /*
        Updating my result using callback.
        */
        CursorManager.removeBusyCursor();
    }

    public function onFault(event:FaultEvent):void {
        if(event.fault.faultCode=="Client.Error.MessageSend")
        {
            //This is where "NetConnection.call.badversion occurs"
        }

        else if(event.fault.faultCode=="Server Exception")
        // Server Exception Handling
        {               
                //Dispatch Something
        }           

    }



    public static function createProxy(callback:ICallback):IFOOProxy {
        if (FOO_PROXY != null) {
            FOO_PROXY.setCallback(callback);
            return FOO_PROXY;        
        }
        var iProxy:IFOOProxy = new FOOProxy();
        var proxy:FOOProxy = iProxy as FOOProxy; 
      //setting my callback here to update
        proxy.remote = new RemoteObject();
        proxy.remote.destination = "Rpc";           
        return proxy;
    }

}

这是它与服务器连接的地方-:Destination id "Rpc"

我使用 https,端口号 5480 并在远程 -config.xml 中使用secure-amf 作为通道

提前致谢。

【问题讨论】:

标签: java apache-flex weborb


【解决方案1】:

您是否使用“https”uri 并使用 AMFChannel 而不是 SecureAMFChannel 构建 remoteObject 的 channelSet?

这种一般性错误可能意味着任何事情,而且更有可能与 IIS 非常棒有关。虽然问题可能与您调用远程操作的方式有关...

如果您已将远程服务抽象为一个神奇的类,请发布一些代码,我可能会给您一些建议......或者我可能不会......'on sait jamais'

很快就和你谈谈, 杰里米

【讨论】:

  • 另外,我发现了一个案例,其中我们得到了 'badversion' 和 500 错误。看起来像我们的核心“ContextInfo”(在后端......包含每个远程调用使用的全局信息的类)。问题是发布时没有相关的数据库架构更改...该表不存在,并且该 ContextInfo 的构造上的 select 语句中没有 try-catch。事情进展顺利,错误非常随机和神秘。
【解决方案2】:

badversion 错误通常是 Web 服务器在执行远程调用时显示错误而不是抛出异常 amf-style 的结果。由于 amf 客户端无法解析响应,因此您会收到该错误消息。

【讨论】:

  • 谢谢您的回复...但是如何做出响应 amf 样式.. flex 是否为此提供任何 api.. 或者有没有办法从 Java 端做?
  • 如果您使用 blazeds,这应该会自动处理。如果没有,这篇博文 (flexpasta.com/index.php/2008/05/16/…) 可能会对您有所帮助。
猜你喜欢
  • 2014-07-25
  • 2014-11-13
  • 2011-03-22
  • 2011-11-10
  • 1970-01-01
  • 2011-10-27
  • 2021-09-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多