From a8ad28157e6b499eaca5bdca65f32bba3a3c396d Mon Sep 17 00:00:00 2001 From: Lubomir Dolezal Date: Fri, 24 Jun 2022 09:40:06 +0200 Subject: [PATCH 1/5] change wps getcapabilities link urls to the one from request --- .../expected/WPS10GetCapabilitiesValidTestCase.xml | 12 ++++++------ .../WPS10PostGetCapabilitiesValidTestCase.xml | 12 ++++++------ .../expected/WPS20GetCapabilitiesValidTestCase.xml | 10 +++++----- .../services/ows/wps/v10/encoders/capabilities.py | 9 +++++---- eoxserver/services/ows/wps/v10/getcapabilities.py | 2 +- eoxserver/services/ows/wps/v20/getcapabilities.py | 8 +++++--- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml b/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml index 375132c27..65b2de8f3 100644 --- a/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml +++ b/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml @@ -48,24 +48,24 @@ Copyright (C) European Space Agency - ESA - - + + - - + + - - + + diff --git a/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml b/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml index 375132c27..65b2de8f3 100644 --- a/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml +++ b/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml @@ -48,24 +48,24 @@ Copyright (C) European Space Agency - ESA - - + + - - + + - - + + diff --git a/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml b/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml index 655d79223..127e832b7 100644 --- a/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml +++ b/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml @@ -52,23 +52,23 @@ Copyright (C) European Space Agency - ESA - - + + - + - - + + diff --git a/eoxserver/services/ows/wps/v10/encoders/capabilities.py b/eoxserver/services/ows/wps/v10/encoders/capabilities.py index 733592846..7ca8c1fdb 100644 --- a/eoxserver/services/ows/wps/v10/encoders/capabilities.py +++ b/eoxserver/services/ows/wps/v10/encoders/capabilities.py @@ -35,6 +35,7 @@ from eoxserver.services.ows.wps.v10.util import ( OWS, WPS, ns_xlink, ns_xml, ) +from eoxserver.services.urls import get_http_service_url from .process_description import encode_process_brief from .base import WPS10BaseXMLEncoder @@ -42,7 +43,7 @@ class WPS10CapabilitiesXMLEncoder(WPS10BaseXMLEncoder): """ WPS 1.0 Capabilities XML response encoder. """ @staticmethod - def encode_capabilities(processes): + def encode_capabilities(processes, request): """ Encode Capabilities XML document. """ conf = CapabilitiesConfigReader(get_eoxserver_config()) @@ -92,7 +93,7 @@ def encode_capabilities(processes): ) ) ), - _encode_operations_metadata(conf), + _encode_operations_metadata(request), WPS("ProcessOfferings", *process_offerings), WPS("Languages", WPS("Default", @@ -112,7 +113,7 @@ def encode_capabilities(processes): ) -def _encode_operations_metadata(conf): +def _encode_operations_metadata(request): """ Encode OperationsMetadata XML element. """ versions = ("1.0.0",) get_handlers = filter_handlers( @@ -124,7 +125,7 @@ def _encode_operations_metadata(conf): all_handlers = sorted( set(get_handlers + post_handlers), key=lambda h: h.request ) - url = conf.http_service_url + url = get_http_service_url(request) return OWS("OperationsMetadata", *[ OWS("Operation", OWS("DCP", diff --git a/eoxserver/services/ows/wps/v10/getcapabilities.py b/eoxserver/services/ows/wps/v10/getcapabilities.py index 696133e8d..9aa1de6a6 100644 --- a/eoxserver/services/ows/wps/v10/getcapabilities.py +++ b/eoxserver/services/ows/wps/v10/getcapabilities.py @@ -42,7 +42,7 @@ class WPS10GetCapabilitiesHandler(object): def handle(self, request): """ Handle HTTP request. """ encoder = WPS10CapabilitiesXMLEncoder() - return encoder.serialize(encoder.encode_capabilities(get_processes())) + return encoder.serialize(encoder.encode_capabilities(get_processes(), request)) class WPS10GetCapabilitiesKVPDecoder(kvp.Decoder): diff --git a/eoxserver/services/ows/wps/v20/getcapabilities.py b/eoxserver/services/ows/wps/v20/getcapabilities.py index 66b4a12af..9e0d179b6 100644 --- a/eoxserver/services/ows/wps/v20/getcapabilities.py +++ b/eoxserver/services/ows/wps/v20/getcapabilities.py @@ -27,12 +27,14 @@ from typing import List +from django.core.handlers.wsgi import WSGIRequest from eoxserver.core.config import get_eoxserver_config from eoxserver.services.ows.common.config import CapabilitiesConfigReader from eoxserver.services.ows.dispatch import filter_handlers from eoxserver.services.ows.wps.util import get_processes from eoxserver.services.ows.wps.interfaces import ProcessInterface from eoxserver.services.ows.wps.v20.common import encode_process_summary +from eoxserver.services.urls import get_http_service_url from ows.wps.v20 import encoders from ows.wps.types import ProcessSummary, ServiceCapabilities @@ -81,7 +83,7 @@ def handle(self, request): hours_of_service=conf.hours_of_service, contact_instructions=conf.contact_instructions, role=conf.role, - operations=self._encode_operations_metadata(conf), + operations=self._encode_operations_metadata(request), process_summaries=encode_process_summaries(), ) @@ -90,7 +92,7 @@ def handle(self, request): return result.value, result.content_type def _encode_operations_metadata( - self, conf: CapabilitiesConfigReader + self, request: WSGIRequest ) -> List[Operation]: get_handlers = filter_handlers( service="WPS", versions=self.versions, method="GET" @@ -101,7 +103,7 @@ def _encode_operations_metadata( all_handlers = sorted( set(get_handlers + post_handlers), key=lambda h: h.request ) - url = conf.http_service_url + url = get_http_service_url(request) return [ Operation( name=handler.request, From 2094510573e483605696c88c043e805ca7dd8f8b Mon Sep 17 00:00:00 2001 From: Lubomir Dolezal Date: Fri, 24 Jun 2022 11:31:33 +0200 Subject: [PATCH 2/5] fix: update tests url to contain ? --- .../WPS10GetCapabilitiesValidTestCase.xml | 12 +++++------ .../WPS10PostGetCapabilitiesValidTestCase.xml | 12 +++++------ .../WPS20GetCapabilitiesValidTestCase.xml | 10 +++++----- .../command_line_test_getcapabilities.xml | 20 +++++++++---------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml b/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml index 65b2de8f3..c12e46e03 100644 --- a/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml +++ b/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml @@ -48,24 +48,24 @@ Copyright (C) European Space Agency - ESA - - + + - - + + - - + + diff --git a/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml b/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml index 65b2de8f3..c12e46e03 100644 --- a/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml +++ b/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml @@ -48,24 +48,24 @@ Copyright (C) European Space Agency - ESA - - + + - - + + - - + + diff --git a/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml b/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml index 127e832b7..597ea7ba5 100644 --- a/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml +++ b/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml @@ -52,23 +52,23 @@ Copyright (C) European Space Agency - ESA - - + + - + - - + + diff --git a/autotest/autotest/expected/command_line_test_getcapabilities.xml b/autotest/autotest/expected/command_line_test_getcapabilities.xml index c180d013a..d033417b9 100644 --- a/autotest/autotest/expected/command_line_test_getcapabilities.xml +++ b/autotest/autotest/expected/command_line_test_getcapabilities.xml @@ -72,8 +72,8 @@ Copyright (C) European Space Agency - ESA - - + + XML @@ -86,8 +86,8 @@ Copyright (C) European Space Agency - ESA - - + + XML @@ -100,8 +100,8 @@ Copyright (C) European Space Agency - ESA - - + + XML @@ -114,8 +114,8 @@ Copyright (C) European Space Agency - ESA - - + + XML @@ -132,8 +132,8 @@ Copyright (C) European Space Agency - ESA - - + + XML From a42dc10fd88f8923654c114453e3ec26a169c8c8 Mon Sep 17 00:00:00 2001 From: Lubomir Dolezal Date: Fri, 24 Jun 2022 12:04:05 +0200 Subject: [PATCH 3/5] fix: revert changes in tests --- .../expected/WPS10GetCapabilitiesValidTestCase.xml | 12 ++++++------ .../WPS10PostGetCapabilitiesValidTestCase.xml | 12 ++++++------ .../expected/WPS20GetCapabilitiesValidTestCase.xml | 10 +++++----- autotest/autotest_services/tests/wps/test_v10.py | 14 +++++++------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml b/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml index c12e46e03..72285e06d 100644 --- a/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml +++ b/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml @@ -48,24 +48,24 @@ Copyright (C) European Space Agency - ESA - - + + - - + + - - + + diff --git a/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml b/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml index c12e46e03..72285e06d 100644 --- a/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml +++ b/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml @@ -48,24 +48,24 @@ Copyright (C) European Space Agency - ESA - - + + - - + + - - + + diff --git a/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml b/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml index 597ea7ba5..33489f101 100644 --- a/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml +++ b/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml @@ -52,23 +52,23 @@ Copyright (C) European Space Agency - ESA - - + + - + - - + + diff --git a/autotest/autotest_services/tests/wps/test_v10.py b/autotest/autotest_services/tests/wps/test_v10.py index 9052a4500..283bdef84 100644 --- a/autotest/autotest_services/tests/wps/test_v10.py +++ b/autotest/autotest_services/tests/wps/test_v10.py @@ -47,7 +47,7 @@ XML_CONTENT_TYPE = "application/xml; charset=utf-8" #=============================================================================== -# WCS 1.0 GetCapabilities +# WPS 1.0 GetCapabilities #=============================================================================== class WPS10GetCapabilitiesValidTestCase(ContentTypeCheckMixIn, WPS10CapabilitiesMixIn, testbase.XMLTestCase): @@ -71,7 +71,7 @@ def getRequest(self): #=============================================================================== -# WCS 1.0 DescribeProcess +# WPS 1.0 DescribeProcess #=============================================================================== @@ -130,7 +130,7 @@ def testValidate(self, XMLData=None): #TODO: Error - invalid process identifier #=============================================================================== -# WCS 1.0 Execute - Minimal Process +# WPS 1.0 Execute - Minimal Process #=============================================================================== class WPS10ExecuteTC06MinimalValidProcess(ContentTypeCheckMixIn, WPS10ExecuteMixIn, testbase.XMLTestCase): @@ -152,7 +152,7 @@ def getRequest(self): return (params, "kvp") #=============================================================================== -# WCS 1.0 Execute - Literal Data Tests +# WPS 1.0 Execute - Literal Data Tests #=============================================================================== class WPS10ExecuteTestCase(ContentTypeCheckMixIn, WPS10ExecuteMixIn, testbase.XMLTestCase): @@ -291,7 +291,7 @@ def getRequest(self): #TODO: Error - invalid input (out of the allowed range) #=============================================================================== -# WCS 1.0 Execute - Bounding Box Data Tests +# WPS 1.0 Execute - Bounding Box Data Tests #=============================================================================== class WPS10ExecuteBoundingBoxTestCase(ContentTypeCheckMixIn, WPS10ExecuteMixIn, testbase.XMLTestCase): @@ -365,7 +365,7 @@ def getRequest(self): #TODO: Error - invalid output CRS #=============================================================================== -# WCS 1.0 Execute - Complex Data Tests (text-based payload) +# WPS 1.0 Execute - Complex Data Tests (text-based payload) #=============================================================================== class WPS10ExecuteComplexDataTextTestCase(ContentTypeCheckMixIn, WPS10ExecuteMixIn, testbase.XMLTestCase): @@ -566,7 +566,7 @@ def getRequest(self): return (params, "kvp") #=============================================================================== -# WCS 1.0 Execute - Complex Data Tests (binary payload) +# WPS 1.0 Execute - Complex Data Tests (binary payload) #=============================================================================== class WPS10ExecuteComplexDataPNGBase64FileTestCase(ContentTypeCheckMixIn, WPS10ExecuteMixIn, testbase.XMLTestCase): From 3cb6b6eb55e03c1ef8f94328fd1dd10e2154fe87 Mon Sep 17 00:00:00 2001 From: Lubomir Dolezal Date: Fri, 24 Jun 2022 12:10:40 +0200 Subject: [PATCH 4/5] fix: revert tests to original state --- .../WPS10GetCapabilitiesValidTestCase.xml | 12 +++++------ .../WPS10PostGetCapabilitiesValidTestCase.xml | 12 +++++------ .../WPS20GetCapabilitiesValidTestCase.xml | 10 +++++----- .../command_line_test_getcapabilities.xml | 20 +++++++++---------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml b/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml index 72285e06d..375132c27 100644 --- a/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml +++ b/autotest/autotest/expected/WPS10GetCapabilitiesValidTestCase.xml @@ -48,24 +48,24 @@ Copyright (C) European Space Agency - ESA - - + + - - + + - - + + diff --git a/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml b/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml index 72285e06d..375132c27 100644 --- a/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml +++ b/autotest/autotest/expected/WPS10PostGetCapabilitiesValidTestCase.xml @@ -48,24 +48,24 @@ Copyright (C) European Space Agency - ESA - - + + - - + + - - + + diff --git a/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml b/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml index 33489f101..655d79223 100644 --- a/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml +++ b/autotest/autotest/expected/WPS20GetCapabilitiesValidTestCase.xml @@ -52,23 +52,23 @@ Copyright (C) European Space Agency - ESA - - + + - + - - + + diff --git a/autotest/autotest/expected/command_line_test_getcapabilities.xml b/autotest/autotest/expected/command_line_test_getcapabilities.xml index d033417b9..f325c6d5d 100644 --- a/autotest/autotest/expected/command_line_test_getcapabilities.xml +++ b/autotest/autotest/expected/command_line_test_getcapabilities.xml @@ -72,8 +72,8 @@ Copyright (C) European Space Agency - ESA - - + + XML @@ -86,8 +86,8 @@ Copyright (C) European Space Agency - ESA - - + + XML @@ -100,8 +100,8 @@ Copyright (C) European Space Agency - ESA - - + + XML @@ -114,8 +114,8 @@ Copyright (C) European Space Agency - ESA - - + + XML @@ -132,8 +132,8 @@ Copyright (C) European Space Agency - ESA - - + + XML From 35812d19ca2c47224a2a3ae4404fb8d7d105c34d Mon Sep 17 00:00:00 2001 From: Lubomir Dolezal Date: Fri, 24 Jun 2022 12:14:07 +0200 Subject: [PATCH 5/5] fix: revert test to original state --- .../command_line_test_getcapabilities.xml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/autotest/autotest/expected/command_line_test_getcapabilities.xml b/autotest/autotest/expected/command_line_test_getcapabilities.xml index f325c6d5d..c180d013a 100644 --- a/autotest/autotest/expected/command_line_test_getcapabilities.xml +++ b/autotest/autotest/expected/command_line_test_getcapabilities.xml @@ -72,8 +72,8 @@ Copyright (C) European Space Agency - ESA - - + + XML @@ -86,8 +86,8 @@ Copyright (C) European Space Agency - ESA - - + + XML @@ -100,8 +100,8 @@ Copyright (C) European Space Agency - ESA - - + + XML @@ -114,8 +114,8 @@ Copyright (C) European Space Agency - ESA - - + + XML @@ -132,8 +132,8 @@ Copyright (C) European Space Agency - ESA - - + + XML