/usr/share/doc/python-twisted-web/examples/soap.py is in python-twisted-web 13.2.0-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This is an example of a simple SOAP server.
Usage:
$ python soap.py
An example session (assuming the server is running):
>>> import SOAPpy
>>> p = SOAPpy.SOAPProxy('http://localhost:8080/')
>>> p.add(a=1)
1
>>> p.add(a=1, b=3)
4
>>> p.echo("Hello World")
'Hello World'
"""
from twisted.web import soap, server
from twisted.internet import reactor, defer
class Example(soap.SOAPPublisher):
"""
It publishs two methods, 'add' and 'echo'.
"""
def soap_echo(self, x):
return x
def soap_add(self, a=0, b=0):
return a + b
soap_add.useKeywords = 1
def soap_deferred(self):
return defer.succeed(2)
reactor.listenTCP(8080, server.Site(Example()))
reactor.run()
|