带有 XMLRPC Python 服务器的 AS3 RemoteObject:“NetConnection.Call.BadVersion”问题

发布于 2024-10-01 09:30:58 字数 1988 浏览 5 评论 0原文

我想在我的 Flex 应用程序和 XMLRPC Python 服务器之间使用 XMLRPC 机制。

我的服务器:

class ServerMockUp(SimpleXMLRPCRequestHandler):
# Services path declaration
rpc_paths = ()

myServer = SimpleXMLRPCServer(("localhost", 80),
                        requestHandler=ServerMockUp,
                        logRequests=True)

def isUserAuthenticated(key, time):
    print "[loginService > isUserAuthenticated]" 
    print ":key='%s' :time=%d" %(key, time)    
    return True

if __name__ == '__main__':
    # Services registration
    myServer.register_function(isUserAuthenticated)
    myServer.register_introspection_functions()
    # Start server ...
    myServer.serve_forever()

我的 services-config.xml 文件:

    ...
    <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
        <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
    </channel-definition>
    ...

这是出现的连接错误:

faultCode:Client.Error.MessageSend faultString:'Send failed'   faultDetail:'Channel.Connect.Failed error NetConnection.Call.BadVersion: : url:  'http://localhost/MyApp/messagebroker/amf''

当我调试 XMLRPC 服务器时,异常是 catch 是(在 SimpleXMLRPCServer 类中):

 params, method = xmlrpclib.loads(data)

带有错误:

str: <?xml version='1.0'?>
<methodResponse>
<fault>
<value><struct>
<member>
<name>faultCode</name>
<value><int>1</int></value>
</member>
<member>
<name>faultString</name>
<value><string>&lt;class 'xml.parsers.expat.ExpatError'&gt;:not well-formed (invalid token): line 1, column 0</string></value>
</member>
</struct></value>
</fault>
</methodResponse>

非常感谢您的帮助!

问候

安东尼

I want to use XMLRPC mechanism between my Flex app and my XMLRPC Python Server.

My server :

class ServerMockUp(SimpleXMLRPCRequestHandler):
# Services path declaration
rpc_paths = ()

myServer = SimpleXMLRPCServer(("localhost", 80),
                        requestHandler=ServerMockUp,
                        logRequests=True)

def isUserAuthenticated(key, time):
    print "[loginService > isUserAuthenticated]" 
    print ":key='%s' :time=%d" %(key, time)    
    return True

if __name__ == '__main__':
    # Services registration
    myServer.register_function(isUserAuthenticated)
    myServer.register_introspection_functions()
    # Start server ...
    myServer.serve_forever()

My services-config.xml file:

    ...
    <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
        <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
    </channel-definition>
    ...

And this is connection error appears:

faultCode:Client.Error.MessageSend faultString:'Send failed'   faultDetail:'Channel.Connect.Failed error NetConnection.Call.BadVersion: : url:  'http://localhost/MyApp/messagebroker/amf''

When I debug my XMLRPC server, the exception is catch is (in SimpleXMLRPCServer class):

 params, method = xmlrpclib.loads(data)

with error :

str: <?xml version='1.0'?>
<methodResponse>
<fault>
<value><struct>
<member>
<name>faultCode</name>
<value><int>1</int></value>
</member>
<member>
<name>faultString</name>
<value><string><class 'xml.parsers.expat.ExpatError'>:not well-formed (invalid token): line 1, column 0</string></value>
</member>
</struct></value>
</fault>
</methodResponse>

Thanks a lot for your help !

Regards

Anthony

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彩扇题诗 2024-10-08 09:30:58

也许它与 objectEncoding 有关。

尝试

nc.defaultObjectEncoding = ObjectEncoding.AMF0;

在连接之前使用 : 将其设置为 AMF0。

Maybe it has something to do with objectEncoding.

Try to set it to AMF0 with :

nc.defaultObjectEncoding = ObjectEncoding.AMF0;

Just before connecting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文