我想在我的 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>
非常感谢你的帮助 !
问候
安东尼