From 74a6407a609e9793402a6d249164812cbcbd1c67 Mon Sep 17 00:00:00 2001 From: Martijn Vermaat <martijn@vermaat.name> Date: Wed, 11 Dec 2013 14:55:41 +0100 Subject: [PATCH] Refactor SOAP service to not instantiate a WSGI by default --- bin/mutalyzer-soap-service.wsgi | 5 ++--- mutalyzer/services/soap.py | 9 --------- mutalyzer/website.py | 10 ++++++---- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/bin/mutalyzer-soap-service.wsgi b/bin/mutalyzer-soap-service.wsgi index 5467bb91..31f7b797 100755 --- a/bin/mutalyzer-soap-service.wsgi +++ b/bin/mutalyzer-soap-service.wsgi @@ -23,15 +23,14 @@ To start the built-in HTTP server on port 8081: import sys from wsgiref.simple_server import make_server +from spyne.server.wsgi import WsgiApplication from mutalyzer.services import soap DEFAULT_PORT = 8081 -# Unfortunately we cannot instantiate wsgi.Application here, see the note -# near the bottom of mutalyzer/services/soap.py. -application = soap.wsgi_application +application = WsgiApplication(soap.application) if __name__ == '__main__': diff --git a/mutalyzer/services/soap.py b/mutalyzer/services/soap.py index 715a2456..5674e6d2 100644 --- a/mutalyzer/services/soap.py +++ b/mutalyzer/services/soap.py @@ -5,7 +5,6 @@ Mutalyzer SOAP/1.1 web service. from spyne.application import Application from spyne.protocol.soap import Soap11 -from spyne.server.wsgi import WsgiApplication import mutalyzer from mutalyzer.services import rpc @@ -16,11 +15,3 @@ application = Application([rpc.MutalyzerService], tns=mutalyzer.SOAP_NAMESPACE, in_protocol=Soap11(validator='lxml'), out_protocol=Soap11(), name='Mutalyzer') - - -# Below we define WSGI applications for use with e.g. Apache/mod_wsgi. -# Note: We would like to create the wsgi.Application instance only in the -# bin/mutalyzer-webservice.wsgi script, but unfortunately this breaks the -# get_interface_document method of spyne which we use to generate API -# documentation in website.py. -wsgi_application = WsgiApplication(application) diff --git a/mutalyzer/website.py b/mutalyzer/website.py index bb1787fe..13817523 100644 --- a/mutalyzer/website.py +++ b/mutalyzer/website.py @@ -30,7 +30,7 @@ import pkg_resources from cStringIO import StringIO from simpletal import simpleTALES from simpletal import simpleTAL -from spyne.interface.wsdl import Wsdl11 +from spyne.server.http import HttpBase import mutalyzer from mutalyzer import util @@ -1541,9 +1541,11 @@ class SoapApi: @todo: Cache this transformation. """ url = web.ctx.homedomain + web.ctx.homepath + SERVICE_SOAP_LOCATION - wsdl = Wsdl11(soap.application.interface) - wsdl.build_interface_document(url) - wsdl_handle = StringIO(wsdl.get_interface_document()) + + soap_server = HttpBase(soap.application) + soap_server.doc.wsdl11.build_interface_document(url) + wsdl_handle = StringIO(soap_server.doc.wsdl11.get_interface_document()) + xsl_handle = open(os.path.join( pkg_resources.resource_filename('mutalyzer', 'templates'), 'wsdl-viewer.xsl'), 'r') -- GitLab