MapServer
MapServer copied to clipboard
inconsistency between handling of wfs_namespace_prefix in GetCapabilities vs GetFeature/DescribeFeatureType operations
From my testing and reading of the code, right now mapserver 8 allows to specify wfs_nameserver_prefix
in the WEB METADATA
section, and in the LAYER METADATA
section.
Depending on how you override one or the other, there are inconsistencies, and i dont know if those are expected/legit or can lead to client bugs.
If i globally set wfs_namespace_prefix
to rge
in a mapfile via WEB METADATA
, querying the GetCapabilities
operation returns XML containing FeatureType
name attributes properly prefixed by rge
:
<FeatureType>
<Name>rge:bdtopo_adresse</Name>
But strangely, i can call DescribeFeatureType
with a typename parameter containing any prefix, it will return the given layer, eg service=wfs&request=describefeaturetype&typename=xxx:bdtopo_adresse&version=2.0.0
will return the same DescribeFeatureType
reply as with ms:bdtopo_adresse
or rge:bdtopo_adresse
. To me, this doesnt allow to have distinct layers with the same name in multiple prefixes in the same service... (as geoserver allows with its workspaces).
One can also override wfs_namespace_prefix
in the LAYER METADATA
section, but that isn't taken into account for GetCapabilities
, where the WEB METADATA
(or the default ms:
) prefix is used in the GetCapabilities
response.
From my testing with setting a distinct wfs_namespace_prefix
in a LAYER METADATA
section, it is only used when building DescribeFeatureType
responses:
<element name="bdtopo_adresse"
type="bdtopo:bdtopo_adresseType"
<element name="dallage_bdortho_rvb_50cm"
type="rge:dallage_bdortho_rvb_50cmType"
while i would have expected the bdtopo_adresse
layer to be listed in the GetCapabilities
document with the overriden prefix (eg <Name>bdtopo:bdtopo_adresse<Name>
) that isnt the case - eg only the global wfs_namespace_prefix
is used, or the default ms:
in GetCapabilities
replies.
The layer-overriden prefix is also correctly used in GetFeature
replies, and one can also use any prefix in the typename
query parameter, it doesnt have to be the 'correct' one.
with more testing, it seems setting wfs_namespace_prefix
breaks GetDescribeFeature
replies, as mapserver doesnt list attributes anymore, only the element
section:
$curl https://fqdn/rge?language=fra&SERVICE=WFS&REQUEST=DescribeFeatureType&VERSION=1.1.0&TYPENAME=bdtopo:lieux_nommes_detail_orographique'
<?xml version='1.0' encoding="UTF-8" ?>
<schema
targetNamespace="http://mapserver.gis.umn.edu/mapserver"
xmlns:rge="http://mapserver.gis.umn.edu/mapserver"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:gml="http://www.opengis.net/gml"
elementFormDefault="qualified" version="0.1" >
<import namespace="http://www.opengis.net/gml"
schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd" />
<element name="lieux_nommes_detail_orographique"
type="bdtopo:lieux_nommes_detail_orographiqueType"
substitutionGroup="gml:_Feature" />
</schema>
in this test, wfs_namespace_prefix
is set to bdtopo
. If i comment it (and thus, the rge
prefix set at WEB METADATA level is used), the same query properly returns all attributes:
<?xml version='1.0' encoding="UTF-8" ?>
<schema
targetNamespace="http://mapserver.gis.umn.edu/mapserver"
xmlns:rge="http://mapserver.gis.umn.edu/mapserver"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:gml="http://www.opengis.net/gml"
elementFormDefault="qualified" version="0.1" >
<import namespace="http://www.opengis.net/gml"
schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd" />
<element name="lieux_nommes_detail_orographique"
type="rge:lieux_nommes_detail_orographiqueType"
substitutionGroup="gml:_Feature" />
<complexType name="lieux_nommes_detail_orographiqueType">
<complexContent>
<extension base="gml:AbstractFeatureType">
<sequence>
<element name="the_geom" type="gml:PointPropertyType" minOccurs="0" maxOccurs="1"/>
<element name="cleabs" minOccurs="0" type="string"/>
<element name="nature" minOccurs="0" type="string"/>
<element name="nature_detaillee" minOccurs="0" type="string"/>
<element name="toponyme" minOccurs="0" type="string"/>
<element name="statut_du_toponyme" minOccurs="0" type="string"/>
<element name="importance" minOccurs="0" type="string"/>
<element name="date_creation" minOccurs="0" type="dateTime"/>
<element name="date_modification" minOccurs="0" type="dateTime"/>
<element name="date_d_apparition" minOccurs="0" type="date"/>
<element name="date_de_confirmation" minOccurs="0" type="date"/>
<element name="sources" minOccurs="0" type="string"/>
<element name="identifiants_sources" minOccurs="0" type="string"/>
<element name="precision_planimetrique" minOccurs="0" type="double"/>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>