xml-rpc python doesn't print output

528 views Asked by At

I'm trying to get an IBM tutorialworks example working but until now there hasn't been any luck

server:

import calendar, SimpleXMLRPCServer

#The server object
class Calendar:
    def getMonth(self, year, month):
        return calendar.month(year, month)

    def getYear(self, year):
        return calendar.calendar(year)


calendar_object = Calendar()
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8888))
server.register_instance(calendar_object)

#Go into the main listener loop
print "Listening on port 8888"
server.serve_forever()

Client:

import xmlrpclib

server = xmlrpclib.ServerProxy("http://localhost:8888")

month = server.getMonth(2002, 8)
print month

It should print out a calendar but it just stalls when I run the client and prints out only "Listening on port 8000"

I'm using python 2.7.2 but the tutorial was written in 2002 september. Is there somekind of syntax difference or I'm doing something wrong.

The tutorial itself is located here http://www.ibm.com/developerworks/webservices/library/ws-pyth10/index.html

Thanks in advance!

1

There are 1 answers

2
wberry On BEST ANSWER

My guess is that something is blocking the low-level bind call to port 8888 in your server process. Run netstat -tlp as root if you can. If you can't, use telnet localhost 8888 to see what if anything is listening.