Technology news and views
RSS icon Email icon Home icon
  • More on Python, SOAP

    Posted on August 11th, 2004 Sandeep 2 comments

    Following my earlier post on Python and SOAP, here is a simple SOAP server that returns a SOAP array (or, correspondingly, a Python list object):

    import SOAPpydef getList():
    list = ["Item 1", "Item 2", "Item 3"]
    return list

    server = SOAPpy.SOAPServer((“localhost”, 9078)) # address tuple
    print “SOAP Server running on localhost:9078″
    server.registerFunction(getList) # expose the method

    except KeyboardInterrupt:

    The SOAP method getList can be invoked using a simple SOAP client like the one below:

    import SOAPpyserver = SOAPpy.SOAPProxy(“http://localhost:9078″)
    list = server.getList()
    print “Got: “, list
    except Exception, e:
    print “Caught exception: “, e

    Next: WSDL. Or something.


    2 responses to “More on Python, SOAP” RSS icon

    • For servers that return simple data types, and every web service I’ve seen so far does, what advantage does SOAP offer over XML-RPC?

      - Dan

    • Dan, for simple data types, I think it really shouldn’t matter if you go for XML-RPC instead of SOAP. The fact that it is heading towards W3C standardization (and it’s backed by Microsoft and IBM) may push more developers into switching over to SOAP.

      For more reading on XML-RPC vs. SOAP, you can refer to this article and Dave Winer‘s History of SOAP.