0

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>&lt;class 'xml.parsers.expat.ExpatError'&gt;:not well-formed (invalid token): line 1, column 0</string></value>
</member>
</struct></value>
</fault>
</methodResponse>

Thanks a lot for your help !

Regards

Anthony

Anthony
  • 325
  • 2
  • 5
  • 15

1 Answers1

0

Maybe it has something to do with objectEncoding.

Try to set it to AMF0 with :

nc.defaultObjectEncoding = ObjectEncoding.AMF0;

Just before connecting.

blue112
  • 52,634
  • 3
  • 45
  • 54