Bug report #17872
WFS 2.0.0 DescribeFeatureType : TypeNames vs TypeName
|Category:||Web Services clients/WFS|
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||Yes||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||25767|
Only TypeNames should be supported in WFS 2.0 but QGIS WFS provider sends TypeName and WFS 2.0 layer cannot be added onto the map.
[bugfix][wfs] Expand support for 2.0.0 TYPENAMES
Fixes #17872 - WFS 2.0.0 DescribeFeatureType : TypeNames vs TypeName
This PR introduces the plural form of TYPENAME for
2.0.0 WFS servers, with some additional logic to
allow for 2.0.0 servers that only support TYPENAME
for DescribeFeatureType: in this case, the singular
form is also tried in case the plural one fails.
There is still some work to do for transactional
support but at least the read-only client part
should now be ok.
Tests have been added to check that:
- TYPENAME form still works with old 2.0.0
- TYPENAMES form works with compliant 2.0.0
- choice geometry types are handled by calling
GetFeature and examining the result
Some servers like http://geoportal.samregion.ru/wfs12 return an
error when issuing a REQUEST=DescribeFeatureType&VERSION=2.0.0&TYPENAME=...
query, which is the conformant way
They expect the plural form TYPENAMES to be passed
As they return an exception when being provided with the singular form,
we can automate the retry with TYPENAMES.
#3 Updated by Alessandro Pasotti over 2 years ago
- Status changed from Open to Feedback
- Priority changed from High to Normal
Ok, thanks for attaching the test endpoint, here are my findings:
1. WFS client 2.0.0 in QGIS client is NOT fully implemented (transactions for example are not)
2. the example server is flawed: in DescribeFeatureType 2.0.0 request the parameter TYPENAME is not plural but singular: http://docs.opengeospatial.org/is/09-025r2/09-025r2.html#147 but http://geoportal.samregion.ru/wfs12?SERVICE=WFS&REQUEST=DescribeFeatureType&VERSION=2.0.0&TYPENAME=EC_1058_33
3. the example server is buggy for an additional reason: if called without TYPENAME it should return all typenames instead of an error
I think we should close this ticket, and instead open a feature request for a complete WFS 2.0.0 implementation in the client, but that would be a complete different story and it will probably need some funding.
#4 Updated by dr - over 2 years ago
It looks like OGC WFS doc is inconsistent. If you look at the next section: http://docs.opengeospatial.org/is/09-025r2/09-025r2.html#148, it says: "The typeNames parameter encodes the names of one or more features types that shall be described by the DescribeFeatureType operation." From GeoServer docs http://docs.geoserver.org/stable/en/user/services/wfs/basics.html: "WFS 2.0.0 ... also changed typeName to typeNames although GeoServer will accept either." So it seems that TYPENAME should be TYPENAMEs for WFS 2.0.0.
#5 Updated by Alessandro Pasotti over 2 years ago
Yes, but the XML example also use the singular: http://docs.opengeospatial.org/is/09-025r2/09-025r2.html#146
Note that GeoServer (that IIRC is the reference implementation) also uses the singular form:
#6 Updated by dr - over 2 years ago
I think that GeoServer instance which you are provide is old. TypeName issue was fixed at GeoServer recently (Nov 22, 2017): https://github.com/geoserver/geoserver/commit/025c34b3bdd626af3ecd96392abc2a136312ccf8