import SOAP
def convert2EUR(currencyID, amount):
   server2call = SOAP.SOAPProxy("http://services.ExchangeRates.com/cgi-bin/exchange.pl", namespace = "urn:ExampleServices:ExchangeRates")
   return amount / float(server2call.getRate(currencyID))

def convertFromEUR(currencyID, amount):
   server2call = SOAP.SOAPProxy("http://services.ExchangeRates.com/cgi-bin/exchange.pl", namespace = "urn:ExampleServices:ExchangeRates")
   return amount * float(server2call.getRate(currencyID))

server = SOAP.SOAPServer(("http://services.ExchangeRates.com", 9900))
server.registerFunction(convert2EUR)
server.registerFunction(convertFromEUR)
server.serve_forever()

