XL-RPC Recipe

Discussion in 'Python' started by Thomas, Jul 18, 2007.

  1. Thomas

    Thomas Guest

    Hi list!

    I'm struggling with a recipe from the Python Cookbook (2nd ed.)
    concerning XML-RPC. It's recipe 15.2 "Serving XML-RPC Requests", and
    since I thought it's a popular book some other folks might have
    discovered (and probably solved) the same issue.

    The recipe provides server and client code, and I get an
    error when trying the following client request:

    print server.python_string.join(['I', 'like it!'], " don't ")

    (In the server code the string name space is mapped into the
    'python_string' member with "import string; self.python_string = string").

    The error report says:

    xmlrpclib.Fault: <Fault 1: '<type \'exceptions.Exception\'>:method
    "python_string.join" is not supported'>

    This happens with all the string methods in
    StringFunctions.python_string. Is there a general issue with mapping
    name spaces into an RPC object? Or am I missing a major point here?

    I tried all of this on a fairly up-to-date Linux with a stock
    Python 2.5 (also tried with WinXP/cygwin/Python2.5.1 and with a
    Stackless 2.5.1, always with same outcome, so I don't believe it's an
    issue of a local installation).

    Any hints?

    =Thomas
     
    Thomas, Jul 18, 2007
    #1
    1. Advertising

  2. Thomas

    Thomas Guest

    Ah, sorry, found the answer myself (not that I wasn't looking for it for
    days...): I was aware that the recipe is online at ActiveState's site
    (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81549), but I
    didn't read all of the comments carefully:

    KAMOSAWA Masao wrote on 2006/04/29 that the use of dotted functions is
    disabled by default in the server (from Python 2.4 onwards). But it can
    be enabled with:

    server.register_instance(StringFunctions(), allow_dotted_names = True)

    =Thomas
     
    Thomas, Jul 18, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pere Montolio

    XML RPC to ONC XDR RPC

    Pere Montolio, Aug 11, 2004, in forum: XML
    Replies:
    0
    Views:
    731
    Pere Montolio
    Aug 11, 2004
  2. Sean Ross

    OT: Genetic Algorithm Recipe Bug Fix

    Sean Ross, Jul 3, 2003, in forum: Python
    Replies:
    6
    Views:
    356
    Andrew Dalke
    Jul 18, 2003
  3. Ymtrader
    Replies:
    1
    Views:
    584
    Adam Tauno Williams
    Mar 15, 2011
  4. Shirish Joshi

    Ruby and Sun-RPC or ONC-RPC ?

    Shirish Joshi, Apr 7, 2004, in forum: Ruby
    Replies:
    0
    Views:
    200
    Shirish Joshi
    Apr 7, 2004
  5. Vladimir Konrad

    rpc (not xml-rpc)

    Vladimir Konrad, Sep 2, 2005, in forum: Ruby
    Replies:
    5
    Views:
    138
    Austin Ziegler
    Sep 3, 2005
Loading...

Share This Page