newbi question on python rpc server, how it works?

K

krishnakant Mane

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
 
L

Larry Bates

krishnakant said:
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
 
G

Goldfish

I have a need where I need to create a layer of business logic that
Spring Python offers something similar (http://springpython.python-
hosting.com/wiki/DistributedRemoting) to link up clients withs
servers. You can code locally, and then when it is time to split
things up between different workstations, you can reconfigure the
networking.

There is a demo application, PetClinic (http://springpython.python-
hosting.com/wiki/PetClinic) that shows a database component, remoting
pieces, and finally a front end. The current version of PetClinic is a
web app. In the near future, we are planning to build a wxPython front
end to show more reusability of components.
 
K

krishnakant Mane

hello all,
I have downloaded the entire twisted library.
I am also trying to read the documentation but I have a couple of
problems right now.
firstly, I did not find any thing in twisted documentation that
specifically talks about xml rpc. am I missing some thing?
secondly, if I am writing an entire application with its logic in an
xml rpc server, do I have to create all my classes as instences of xml
rpc server (just like I create a java servlet or a php script)? or is
it that I just create one xml rpc server class which is like the entri
point for all other classes in the package?
can you provide a couple of links to howtos or tutorials on creating
xml rpc servers and clients with twisted python? I am also confused
as to how will I mix the functionality of MySQLDB with twisted python?
I am asking this because I felt twisted much cleaner to use than the
modules coming with python itself. again I may be wrong and some one
might point me to the possible problems with this aproach in the long
run.
regards.
Krishnakant.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top