newbi question on python rpc server, how it works?

Larry Bates lbates at websafe.com
Wed Mar 28 15:04:00 EDT 2007


krishnakant Mane wrote:
> hello,
> searched a lot of places including google search but can't find
> answers to python-rpc.  I am also very new to rpc.  I am very clear
> about its meaning and where it is to be used, but not about how it is
> done.
> I have a need where I need to create a layer of business logic that
> will connect to mysql database at one end and a wxpython based thin
> client at the other end.
> can some one give me basic idea as to how I can use simple xml rpc
> server class of python and build an xml rpc server and then a client
> which I can embed in my wxpython based thin client?
> as I said I am not aware of how xml rpc works in details.
> I want to creat the wxpython client app in such a way that it only
> does the work of validation and display and only sending the data as
> is to the xml rpc server for logic and then xml rpc server will
> inturn talk to mysql.
> my business logic consists of many classes which I want to put in a
> package directory with __init__.py and all the other modules.
> do I need to create all of them as xml rpc server instances or can I
> use them into one single xml rpc server class?
> at the other end I am not really understanding how the xml rpc client
> can be used to get data in to my wx based gui?
> for example I want to fill up a list box with data that came from the
> rpc server to the client and then some how looping through the
> elements sent over and putting into a list.
> 
> regards.
> Krishnakant

I'm no expert, but maybe I can get you started.

If you understand how a SQL database works you can extend that knowledge
to RPC.  You make queries to the RPC server and it returns responses.
The format of the queries/responses is "normally" XML, but I'm pretty
sure you could invent your own if you wanted to (probably a bad idea).
Basically you define an API (like SQL queries define their API) that is
used by the clients to make requests, update information, retrieve
information, etc.

You probably should take a look at Twisted module.  It does XMLRPC with
just a few lines of code and also would scale well as you have many
users talking to the server.  Download Twisted and take a look.  You
might also want to pick up a copy of "Twisted Network Programming
Essentials":

http://www.oreilly.com/catalog/twistedadn/

I'll bet it will be worth the purchase price if you choose to go this
direction.

-Larry Bates



More information about the Python-list mailing list