带有 XMLRPC Python 服务器的 AS3 RemoteObject:“NetConnection.Call.BadVersion”问题
我想在我的 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><class 'xml.parsers.expat.ExpatError'>: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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许它与 objectEncoding 有关。
尝试
在连接之前使用 : 将其设置为 AMF0。
Maybe it has something to do with objectEncoding.
Try to set it to AMF0 with :
Just before connecting.