# Collection of code snippets by Arne Vajhøj 
# (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
from spyne import Application, rpc, ServiceBase, Iterable, String
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication
from wsgiref.simple_server import make_server

class S2Service(ServiceBase):
    msgs = []
    @rpc(String, _returns=Iterable(String))
    def process(self, msg):
        S2Service.msgs.append(msg)
        return S2Service.msgs

app = Application([S2Service], tns='vmsipc', in_protocol=Soap11(), out_protocol=Soap11(), name='S2')
wsgi = WsgiApplication(app)
srv = make_server('localhost', 8000, wsgi)
srv.serve_forever()
