diff --git a/doc/config.rst b/doc/config.rst index 43535b1350fca1b5e378e6d6efcea9add1913666..cd8ebf976ab1651b8e908df765c1aa1f86142617 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -185,10 +185,10 @@ REVERSE_PROXIED .. _config-soap-wsdl-url: SOAP_WSDL_URL - URL to the SOAP webservice WSDL document. Used for linking to it from the - documentation page on the website. + URL to the SOAP webservice WSDL document. Used to build the WSDL document + and for linking to it from the documentation page on the website. - `Default value:` ``https://mutalyzer.nl/services/?wsdl`` + `Default value:` `None` .. _config-json-root-url: @@ -196,7 +196,7 @@ JSON_ROOT_URL URL to the HTTP/RPC+JSON webservice root (without trailing slash). Used for linking to it from the documentation page on the website. - `Default value:` ``https://mutalyzer.nl/json`` + `Default value:` `None` Piwik settings diff --git a/mutalyzer/config/default_settings.py b/mutalyzer/config/default_settings.py index c01d47a56c9494da32fc32313be35e4275ced23a..84c2373e813f37a1f7305440e14cc35df04ef07e 100644 --- a/mutalyzer/config/default_settings.py +++ b/mutalyzer/config/default_settings.py @@ -72,8 +72,8 @@ PROTEIN_LINK_EXPIRATION = 60 * 60 * 24 * 30 # seconds). NEGATIVE_PROTEIN_LINK_EXPIRATION = 60 * 60 * 24 * 5 -# URL to the SOAP webservice WSDL document. Used for linking to it from the -# documentation page on the website. +# URL to the SOAP webservice WSDL document. Used to build the WSDL document +# and for linking to it from the documentation page on the website. SOAP_WSDL_URL = 'https://mutalyzer.nl/services/?wsdl' # URL to the HTTP/RPC+JSON webservice root (without trailing slash). Used for diff --git a/mutalyzer/entrypoints/service_soap.py b/mutalyzer/entrypoints/service_soap.py index 8179faa358e7e109442cef799b1ffc2f8e4c0128..40da7294de6b4761b4bcdaa08476cf875b6bb2fd 100644 --- a/mutalyzer/entrypoints/service_soap.py +++ b/mutalyzer/entrypoints/service_soap.py @@ -40,6 +40,22 @@ logging.getLogger('spyne.protocol.xml').setLevel(log_level) #: WSGI application instance. application = WsgiApplication(soap.application) + +# By default, the first request will trigger a build of the WSDL document, +# using the context (service location) from that request. For example, if the +# first request is on `http://localhost/` and subsequent requests are on +# `https://mutalyzer.nl/services/`, they will not have a valid WSDL document. +# +# This is actually what we do on our production infrastructure, where the +# service is tested (on localhost) after it has been started. +# +# The fix is to force a build of the WSDL document and specifying the location +# to use. +# +# http://spyne.io/docs/2.10/reference/server.html#spyne.server.wsgi.WsgiApplication +if settings.SOAP_WSDL_URL: + application.doc.wsdl11.build_interface_document(settings.SOAP_WSDL_URL) + if settings.REVERSE_PROXIED: application = _ReverseProxied(application) diff --git a/mutalyzer/website/views.py b/mutalyzer/website/views.py index bc0a339ebe3d16f3a7124d2699d2e8c5baa96d0c..db179140b656a754a65a36fc55ba574c4d8d209f 100644 --- a/mutalyzer/website/views.py +++ b/mutalyzer/website/views.py @@ -50,8 +50,8 @@ def global_context(): 'release' : mutalyzer.__version_info__[-1] != 'dev', 'copyright_years' : mutalyzer.COPYRIGHT_YEARS, 'contact_email' : settings.EMAIL, - 'soap_wsdl_url' : settings.SOAP_WSDL_URL, - 'json_root_url' : settings.JSON_ROOT_URL, + 'soap_wsdl_url' : settings.SOAP_WSDL_URL or 'https://mutalyzer.nl/services/?wsdl', + 'json_root_url' : settings.JSON_ROOT_URL or 'https://mutalyzer.nl/json', 'piwik' : settings.PIWIK, 'piwik_base_url' : settings.PIWIK_BASE_URL, 'piwik_site_id' : settings.PIWIK_SITE_ID, @@ -144,7 +144,8 @@ def soap_api(): .documentation { white-space: pre-line; } """ soap_server = HttpBase(soap.application) - soap_server.doc.wsdl11.build_interface_document(settings.SOAP_WSDL_URL) + soap_server.doc.wsdl11.build_interface_document( + settings.SOAP_WSDL_URL or 'https://mutalyzer.nl/services/?wsdl') wsdl_string = soap_server.doc.wsdl11.get_interface_document() xsl_file = os.path.join(