[Twisted-Python] Adding introspection to xlmrpc server
glyph at twistedmatrix.com
Sun Jul 31 17:02:38 MDT 2011
On Jul 31, 2011, at 1:01 AM, Justin Frost wrote:
> I'm trying the example found at:
> And it doesn't seem to be working. The following test code fails:
> import xmlrpclib
> s = xmlrpclib.ServerProxy("http://localhost:8080")
> print s.listMethods()
> The error says that the listMethods method isn't defined. If I create an xmrpc server without twisted and add introspection, it works fine. Is there a problem with the example or am I doing something wrong?
As per the XML-RPC introspection specification <http://xmlrpc-c.sourceforge.net/introspection.html>, the method you're looking for is 'system.listMethods', not 'listMethods'.
You can fix your client example by doing 'print s.system.listMethods()' instead of 'print s.listMethods()'.
I'm assuming that the "xmlrpc server without Twisted" is violating the spec for convenience; you can always make an xmlrpc_listMethods yourself which calls the introspection object's listMethods.
Hope this helps,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python