Skip to content

Instantly share code, notes, and snippets.

@plq
Last active December 29, 2015 11:39
Show Gist options
  • Select an option

  • Save plq/7665245 to your computer and use it in GitHub Desktop.

Select an option

Save plq/7665245 to your computer and use it in GitHub Desktop.
simple type as __in_header__ does not work
import logging
from spyne.model.primitive import Boolean, Unicode, Integer
from spyne.model.complex import ComplexModel
from spyne.service import ServiceBase
from spyne.decorator import rpc
class SomeService(ServiceBase):
__in_header__ = Unicode(sub_name='myinfo')
@rpc(Unicode)
def MyMethod(ctx, mymethodparam):
print "I got:", mymethodparam
print "myinfo:", ctx.in_header
if __name__ == '__main__':
from spyne.application import Application
from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication
from wsgiref.simple_server import make_server
logging.basicConfig(level=logging.DEBUG)
logging.info('listening to http://127.0.0.1:8000')
application = Application([SomeService],
'myapp',
in_protocol=Soap11(validator='lxml'),
out_protocol=Soap11())
wsgi_application = WsgiApplication(application)
server = make_server('127.0.0.1', 8000, wsgi_application)
server.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment