Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute requests seem to be wrong #32

Closed
gfenoy opened this issue Feb 8, 2023 · 6 comments · Fixed by #35
Closed

Execute requests seem to be wrong #32

gfenoy opened this issue Feb 8, 2023 · 6 comments · Fixed by #35
Assignees
Projects
Milestone

Comments

@gfenoy
Copy link

gfenoy commented Feb 8, 2023

Describe the bug
We can see in the available execute request example (https://schemas.opengis.net/wps/2.0/xml-examples/wpsExecuteRequestExample.xml) that the Data block is defined differently that in the ETS examples used as request templates (https://github.com/opengeospatial/ets-wps20/tree/main/src/main/resources/org/opengis/cite/wps20/examples).

In the official schemas.opengis.net, we have the following:

<wps:Input id="DISTANCE">
  <wps:Data>10.0</wps:Data>
</wps:Input>

In the ETS example, we have for instance, the following:

<wps:Input id="example.input.id">
  <wps:Data>
    <wps:LiteralValue>hello_literal</wps:LiteralValue>
  </wps:Data>
</wps:Input>

This extra LiteralValue block seems to be necessary to the default instance to work, but we don't see any in the official example.

To Reproduce
Deploy the ETS using docker

Expected behavior
The ETS should use Execute requests without extra block such as LiteralValue and ComplexData which are not defined in table 23 just after the figure 16.

@ghobona
Copy link
Contributor

ghobona commented Feb 8, 2023

Figure 16 specifies that <wps:Data> accepts any payload. The XSD also states the same, by virtue of extending <extension base="anyType">.

The XSD also states that "This element is used to embed the data in a WPS request or response. The content can be XML data, plain character data, or specially encoded binary data (i.e. base64). "

Therefore the Execute requests sent by the ETS are correct as per the Standard and the XSD.

@gfenoy
Copy link
Author

gfenoy commented Feb 8, 2023

xmllint command reports that there is an issue with ComplexData, please, see bellow.

xmllint --schema "http://schemas.opengis.net/wps/2.0/wpsExecute.xsd" Echo_Process_Complex.xml
<?xml version="1.0"?>
<wps:Execute xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" mode="sync" response="raw" service="WPS" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/wps/2.0 http://schemas.opengis.net/wps/2.0/wps.xsd">
    <ows:Identifier>echo</ows:Identifier>
	  <wps:Input id="b">
        <wps:Data>
            <wps:ComplexData>
                <testElement>hello_complex</testElement>
            </wps:ComplexData>
        </wps:Data>
    </wps:Input>
    <wps:Output id="b" transmission="value"/>
</wps:Execute>
Echo_Process_Complex.xml:14: element testElement: Schemas validity error : Element 'testElement': This element is not expected. Expected is ( {http://www.opengis.net/wps/2.0}Format ).
Echo_Process_Complex.xml fails to validate

When the following validates.

xmllint --schema "http://schemas.opengis.net/wps/2.0/wpsExecute.xsd" FixedEcho_Process_Complex.xml
<?xml version="1.0"?>
<wps:Execute xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" mode="sync" response="raw" service="WPS" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/wps/2.0 http://schemas.opengis.net/wps/2.0/wps.xsd">
    <ows:Identifier>echo</ows:Identifier>
	  <wps:Input id="b">
        <wps:Data>
                <testElement>hello_complex</testElement>
        </wps:Data>
    </wps:Input>
    <wps:Output id="b" transmission="value"/>
</wps:Execute>
FixedEcho_Process_Complex.xml validates

For the LiteralData it is a bit different. Indeed the two versions validate. Please, see bellow examples.

xmllint --schema "http://schemas.opengis.net/wps/2.0/wpsExecute.xsd" Echo_Process_Literal.xml
<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" mode="sync" response="raw" service="WPS" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/wps/2.0 http://schemas.opengis.net/wps/2.0/wps.xsd">
    <ows:Identifier>echo</ows:Identifier>
	  <wps:Input id="a">
        <wps:Data>
            <wps:LiteralValue>hello_literal</wps:LiteralValue>
        </wps:Data>
    </wps:Input>
	  <wps:Output id="a" transmission="value"/>
</wps:Execute>
Echo_Process_Literal.xml validates

But this version also validates.

xmllint --schema "http://schemas.opengis.net/wps/2.0/wpsExecute.xsd" FixedEcho_Process_Literal.xml
<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" mode="sync" response="raw" service="WPS" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/wps/2.0 http://schemas.opengis.net/wps/2.0/wps.xsd">
    <ows:Identifier>echo</ows:Identifier>
	  <wps:Input id="a">
        <wps:Data>hello_literal</wps:Data>
    </wps:Input>
	  <wps:Output id="a" transmission="value"/>
</wps:Execute>
FixedEcho_Process_Literal.xml validates

Nevertheless, I would add that in this case, only the second version of the request means that you are passing the string "hello_literal". In the first version of the request, you are passing the value <wps:LiteralValue>hello_literal</wps:LiteralValue> which looks odd value for a string. Also, as the ETS is then searching for the string "hello_literal" rather than the previously mentioned string value, it leads to normal failure of the test.

@ghobona
Copy link
Contributor

ghobona commented Feb 8, 2023

@gfenoy You are correct regarding hello_literal. The code in Line#140 appears to be only looking for the value of the string. The ETS will be updated to fix the issue.

The <wps:ComplexData> issue needs some further research.

@gfenoy
Copy link
Author

gfenoy commented Feb 8, 2023

<wps:ComplexData> should be used in ProcessDescription, I cannot recall any other use of it in WPS 2.0.0.

In our implementation, we return an invalid XML file as a result (using the wps namespace which is not defined).

In case we remove this block, we make the request validate against the XSD, which is a requirement.

@gfenoy
Copy link
Author

gfenoy commented Feb 8, 2023

The XSD also states that "This element is used to embed the data in a WPS request or response. The content can be XML data, plain character data, or specially encoded binary data (i.e. base64). "

In case you are willing to use XML data, you are allowed to do so. Nevertheless, when you include the extra <wps:ComplexData> block, it means you add it as the root node of the XML data. It makes your node content (extracted from the initial XML, with no namespace definition included) not valid once returned as-is (raw). Implementers can easily solve this specifically for the echo service and remove the <wps:ComplexData> from the corresponding output, but I don't think it is a requirement to do so to be a compliant WPS implementation.

@ghobona
Copy link
Contributor

ghobona commented Mar 15, 2023

Since the literal value check only checks for the string hello_literal in the response there is no need to change that part of the code.

However, the complex data check needed to be modified to ensure that the Execute request was passed xml validation. This has now been done through PR #35

@ghobona ghobona added this to To do in CITE via automation Mar 15, 2023
@ghobona ghobona moved this from To do to In progress in CITE Mar 15, 2023
CITE automation moved this from In progress to Done Mar 29, 2023
@dstenger dstenger added this to the 0.4 milestone Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
CITE
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants