opengeospatial / ets-wfs20

Executable Test Suite for WFS 2.0
Other
9 stars 11 forks source link

Expected locator attribute to contain 'language' in test Manage stored queries > create Stored Query With Unsupported Query Language #114

Closed zguo closed 6 years ago

zguo commented 6 years ago

post request url http://inspiredemo.esri.com:6080/arcgis/rest/services/au/MapServer/exts/InspireFeatureDownload/service

the request sent by the test:

<CreateStoredQuery xmlns="http://www.opengis.net/wfs/2.0" service="WFS" version="2.0.0">
  <StoredQueryDefinition xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                          id="urn:example:wfs2-query:InvalidLang">
      <Title>GetFeatureByTypeName</Title>
      <Abstract>Returns feature representations by type name.</Abstract>
      <Parameter name="typeName" type="xsd:QName">
         <Abstract>Qualified name of feature type (required).</Abstract>
      </Parameter>
      <QueryExpressionText isPrivate="false" language="http://qry.example.org"
                           returnFeatureTypes="${typeName}">
         <Query typeNames="${typeName}"/>
      </QueryExpressionText>
  </StoredQueryDefinition>
</CreateStoredQuery>

response

<cnt:rest><ExceptionReport xmlns="http://www.opengis.net/ows/1.1" version="2.0.0">
   <Exception exceptionCode="InvalidParameterValue" locator="unknown">
      <ExceptionText>Operation request contains an invalid parameter value.</ExceptionText>
      <ExceptionText>Operation request contains an invalid parameter value. WFS request is incorrect:
Error in file &amp;quot;WFS-POST-REQUEST&amp;quot;, line 8, column 111
                                   Message: value '${typeName}' is invalid QName
XercesXML - Parsing finished with errors.
</ExceptionText>
   </Exception>
</ExceptionReport></cnt:rest>

Error: Expected locator attribute to contain 'language']

Analysis: Method: createStoredQueryWithUnsupportedQueryLanguage() creates a POST request based on CreateStoredQuery-GetFeatureByTypeName.xml template, if substitute ${typeName} in request with the real typeName and add xmlns value from capabilities. the response will give correct locator='language'

Expected request to be sent (example): the difference is at: xmlns:au="http://inspire.ec.europa.eu/schemas/au/4.0" returnFeatureTypes="au:AdministrativeBoundary" typeNames="au:AdministrativeBoundary"

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<CreateStoredQuery xmlns="http://www.opengis.net/wfs/2.0" xmlns:au="http://inspire.ec.europa.eu/schemas/au/4.0" service="WFS" version="2.0.0">
  <StoredQueryDefinition xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                          id="urn:example:wfs2-query:InvalidLang">
      <Title>GetFeatureByTypeName</Title>
      <Abstract>Returns feature representations by type name.</Abstract>
      <Parameter name="typeName" type="xsd:QName">
         <Abstract>Qualified name of feature type (required).</Abstract>
      </Parameter>
      <QueryExpressionText isPrivate="false" language="http://qry.example.org"
                           returnFeatureTypes="au:AdministrativeBoundary">
         <Query typeNames="au:AdministrativeBoundary"/>
      </QueryExpressionText>
  </StoredQueryDefinition>
</CreateStoredQuery>
dstenger commented 6 years ago

Thank you for reporting.

You are right, ${typeName} is not replaced and namespace binding not added. This must be fixed in the test.

lgoltz commented 6 years ago

The placeholder ${typeName} is a parameter which is defined before in the StoredQueryDefintion:

<Parameter name="typeName" type="xsd:QName">

But of course the attribute returnFeatureTypes is defined as follows [1]:

<xsd:list itemType="xsd:QName"/>

That's why the schema validation fails.

Correct would be:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<CreateStoredQuery xmlns="http://www.opengis.net/wfs/2.0" xmlns:au="http://inspire.ec.europa.eu/schemas/au/4.0" service="WFS" version="2.0.0">
...
      <QueryExpressionText isPrivate="false" language="http://qry.example.org"
                           returnFeatureTypes="LIST_OF_ALL_PROVIDED_FEATURE_TYPES">
      <Query typeNames="${typeName}"/>
...
</CreateStoredQuery>

An other option (see #100) would be an empty attribute:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<CreateStoredQuery xmlns="http://www.opengis.net/wfs/2.0" xmlns:au="http://inspire.ec.europa.eu/schemas/au/4.0" service="WFS" version="2.0.0">
...
      <QueryExpressionText isPrivate="false" language="http://qry.example.org"
                           returnFeatureTypes="">
      <Query typeNames="${typeName}"/>
...
</CreateStoredQuery>

[1] http://schemas.opengis.net/wfs/2.0/wfs.xsd

lgoltz commented 6 years ago

returnFetaureType was set to an empty string: PR #118

dstenger commented 6 years ago

Functional test of fix

Used service: http://inspiredemo.esri.com:6080/arcgis/rest/services/au/MapServer/exts/InspireFeatureDownload/service?service=WFS&request=GetCapabilities&version=2.0.0

Test create Stored Query With Unsupported Query Language does not fail.

Test was executed with Docker Image which can be built in this repository.