Spyne has a class WsgiMounter
for this:
from spyne.util.wsgi_wrapper import WsgiMounter
app1 = Application([SomeService], tns=tns,
in_protocol=Soap11(), out_protocol=Soap11())
app2 = Application([SomeOtherService], tns=tns,
in_protocol=Soap11(), out_protocol=Soap11())
wsgi_app = WsgiMounter({
'app1': app1,
'app2': app2,
})
Now you can pass wsgi_app
to the Wsgi implementation using the same way that you passed the instance WsgiApplication
.
Wsgi , , . - 404.
: https://github.com/plq/spyne/blob/master/examples/multiple_protocols/server.py
, Service
. , :
def SomeServiceFactory():
class SomeService(ServiceBase):
@rpc(Unicode, _returns=Unicode)
def echo_string(ctx, string):
return string
return SomeService
SomeServiceFactory()
Application
.
.
app1 = Application([SomeServiceFactory()], tns=tns,
in_protocol=Soap11(), out_protocol=Soap11())
app2 = Application([SomeServiceFactory()], tns=tns,
in_protocol=Soap11(), out_protocol=Soap11())
, .