473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Setting up test for XML-RPC

I'm trying to test out Python XML-RPC for the first time, and can't find
anything that executes a call end to end.

I thought that I would use SimpleXMLRPCServer to run a simple server on
localhost, and xmlrpclib to run a client that connects to it, but they don't
seem to register the same functions. The server test code registers 'pow'
and 'add' (in the Python 2.3 distribution) but the client seems to call
"print server.examples.getStateName(41)". It doesn't seem like they were
meant to work together as a unit test, although that would seem logical.

Can anyone help me just get a single XML-RPC call to execute (and I want to
see both the client and server code)? I have googled extensively and
haven't come up with anything.

Also -- I'm investigating this for a nightly build process involving many
machines. There is going to be a master machine that sends requests to 20
other machines to build things. They're just a bunch of Windows XP
machines, with almost no software on them. What software would I need to
install to run XML-RPC servers on them to receive requests? Just Python and
a web server like Apache?

If there are any other _very_ lightweight RPC mechanisms, I would appreciate
hearing about them. I am writing some build scripts in Python, and while I
could for example schedule a task on 20 machines separately, it would be
nicer to have a master machine control when the build happened, etc. and be
able to manage dependencies by waiting for a return result, etc. All I want
to do is execute a python function on a remote machine and get a result
back. It is all done in a local, secure environment.

Thanks for all the previous responses to my questions -- this newsgroup has
been very helpful.

MB
Jul 18 '05 #1
4 2038
OK, I tried the obvious and it worked. : ) I just changed the call to
server.pow(3,5) and it returns the correct result. I wonder why they aren't
set up that way in the first place.

But the second question still stands. I am running both the client and
server on my own machine now (Windows 2000). Would I just need Python and
web server if they were different machines? I would like to avoid
installing a bunch of software on the 20 machines if possible.

thanks,
MB

"Moosebumps" <cr**@crud.com> wrote in message
news:cD*****************@newssvr29.news.prodigy.co m...
I'm trying to test out Python XML-RPC for the first time, and can't find
anything that executes a call end to end.

I thought that I would use SimpleXMLRPCServer to run a simple server on
localhost, and xmlrpclib to run a client that connects to it, but they don't seem to register the same functions. The server test code registers 'pow'
and 'add' (in the Python 2.3 distribution) but the client seems to call
"print server.examples.getStateName(41)". It doesn't seem like they were
meant to work together as a unit test, although that would seem logical.

Can anyone help me just get a single XML-RPC call to execute (and I want to see both the client and server code)? I have googled extensively and
haven't come up with anything.

Also -- I'm investigating this for a nightly build process involving many
machines. There is going to be a master machine that sends requests to 20
other machines to build things. They're just a bunch of Windows XP
machines, with almost no software on them. What software would I need to
install to run XML-RPC servers on them to receive requests? Just Python and a web server like Apache?

If there are any other _very_ lightweight RPC mechanisms, I would appreciate hearing about them. I am writing some build scripts in Python, and while I could for example schedule a task on 20 machines separately, it would be
nicer to have a master machine control when the build happened, etc. and be able to manage dependencies by waiting for a return result, etc. All I want to do is execute a python function on a remote machine and get a result
back. It is all done in a local, secure environment.

Thanks for all the previous responses to my questions -- this newsgroup has been very helpful.

MB

Jul 18 '05 #2

MB> OK, I tried the obvious and it worked. : ) I just changed the call
MB> to server.pow(3,5) and it returns the correct result. I wonder why
MB> they aren't set up that way in the first place.

The xmlrpclib module predates SimpleXMLRPCServer by a fair amount. The
getStateName() test was meant to connect to UserLand's original test server.
As I recall, that was the sole function it exported. I don't see any reason
why SimpleXMLRPCServer needs to implement getStateName(), but I imagine it
would be reasonable for xmlrpclib's test to call pow().

MB> But the second question still stands. I am running both the client
MB> and server on my own machine now (Windows 2000). Would I just need
MB> Python and web server if they were different machines? I would like
MB> to avoid installing a bunch of software on the 20 machines if
MB> possible.

You should be able to build a server and a client with just the standard
Python distribution. If performance is an issue (it will be if you are
passing large chunks of data back and forth), there are some things you can
do to speed it up:

* Install Fredrik Lundh's sgmlop module.

* Marshal or pickle your data first, then base64 encode them before
passing them to or fro. This greatly reduces the number of XML tags
on-the-wire, and thus the encode/decode time and data size.
Obviously, this only works if you are talking Python-to-Python.

* Tweak things to gzip-encode the traffic between server and client.

* Use the xmlrpclib.MultiCall class to bundle logical multiple calls
into a single physical XML-RPC call.

Skip

Jul 18 '05 #3
> MB> But the second question still stands. I am running both the
client
MB> and server on my own machine now (Windows 2000). Would I just need MB> Python and web server if they were different machines? I would like MB> to avoid installing a bunch of software on the 20 machines if
MB> possible.

You should be able to build a server and a client with just the standard
Python distribution.
Really? That would be awesome. But I don't see how that works... what do
you enter for the URL? (right now it is just http://localhost, but
obviously I would need to specify 20 different machines for my system. They
are just bare Windows XP Pro machines with a default installation. They're
"Windows Server" machines, I don't think.

If performance is an issue (it will be if you are passing large chunks of data back and forth), there are some things you can do to speed it up:

* Install Fredrik Lundh's sgmlop module.

* Marshal or pickle your data first, then base64 encode them before
passing them to or fro. This greatly reduces the number of XML tags
on-the-wire, and thus the encode/decode time and data size.
Obviously, this only works if you are talking Python-to-Python.

* Tweak things to gzip-encode the traffic between server and client.

* Use the xmlrpclib.MultiCall class to bundle logical multiple calls
into a single physical XML-RPC call.


Thanks for these suggestions.

MB
Jul 18 '05 #4
You should be able to build a server and a client with just the
standard Python distribution.


MB> Really? That would be awesome. But I don't see how that
MB> works... what do you enter for the URL? (right now it is just
MB> http://localhost, but obviously I would need to specify 20 different
MB> machines for my system. They are just bare Windows XP Pro machines
MB> with a default installation. They're "Windows Server" machines, I
MB> don't think.

Doesn't matter. Suppose you ran the server on win.foobar.tv, listening to
port 1234. In the client you'd call ServerProxy like so:

server = ServerProxy("http://win.foobar.tv:1234")
print server.exanples.echo("My dog has fleas")

Skip

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: StepH | last post by:
Hi, I've this module : from optparse import OptionParser import re _version = "P1" def writeVar(f, line):
9
by: Weekend | last post by:
Currently, i want to develope a multiple choice exam website. The content of the test is store in an XML file. I want to carry out some function. Could you tell me which programming language should...
4
by: Ian | last post by:
I would like to set a path to a schema where both the xml file and the schema are on my local hard drive (e.g. c:\XML\auto.xml and c:\XML\auto.xsd) Thank you, Ian
8
by: Wayne Wengert | last post by:
I am trying to build a VB.NET Windows application in which I want to create an XML file from data collected from the user and stored in arrays. I am looking for any pointers to information on how...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
2
by: Greg | last post by:
Please note: I have cross posted this from Newsgroup: microsoft.public.dotnet.framework.aspnet.webservices with a few minor changes... I am having a simple problem setting up the security on my...
4
by: michael sorens | last post by:
I have successfully bound an XmlDocument to a DataGridView but all fields seem to be strings. I want to retrofit appropriate datatypes on some of the fields. Let me take this in 2 parts. Part...
1
by: Sam | last post by:
I am working with .Net 2.0. I found a 2002 posting with this sample code of how to send a node-set into a XSLT transformation: string xml = @"<foo><bar>The Test</bar></foo>"; string xsl =...
6
by: bruce_phipps | last post by:
If I have an <element name="test" maxOccurs="unbounded"> with no minOccurs attribute specified does this mean I can have 0..unbounded occurences of <test>? Or 1..unbounded occurences of test? ...
1
by: sidathkp | last post by:
Here is a sample of the xml file that I have: <provider> <cinames> <cinema> <id>1111</id> <name>ABC cinema</name> <address>123 street</address>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.