1

I tried to cascade a WFS (https://isk.geobasis-bb.de/ows/alkis_vereinf_wfs?) using my GeoServer to produce a layer that I could include in my app. Unfortunately, the body has to be a xmlin raw-format to the request containing the bounding box etc.

Using postman it worked when I added this to the body -> raw:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" xmlns:adv="http://www.adv-online.de/namespaces/adv/gid/6.0" xmlns:fg="http://www.interactive-instruments.de/ns/aaa/flurgema" xmlns:gml="http://www.opengis.net/gml" xmlns:gml32="http://www.opengis.net/gml/3.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" outputFormat="text/xml; subtype=gml/3.2.1" resultType="results">
    <wfs:Query typeName="ave:Flurstueck" xmlns:ave="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0">
        <ogc:Filter>
            <ogc:BBOX> 
                <gml:Envelope srsName="urn:ogc:def:crs:EPSG::25833" srsDimension="2"> 
                    <gml:lowerCorner>332590 5807162</gml:lowerCorner> 
                    <gml:upperCorner>332807 5807263</gml:upperCorner> 
                </gml:Envelope> 
            </ogc:BBOX> 
        </ogc:Filter>
    </wfs:Query>                  
</wfs:GetFeature>

Is there a way to do this with GeoServer 2.14.3?

2 Answers 2

2

The remote WFS conforms to the specifications used (XML, WFS, GML, Filter Encoding). It may be somewhat strict, but it is not "broken".

Furthermore, while the request is "well-formed" as XML, it is at least problematic because it uses a GML property without specifying which namespace it belongs to.

Let me try to explain briefly why this is so:

The DescribeFeatureType response is a GML Application Schema and defines the feature and its properties in a specific XML Namespace (here: targetNamespace="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0"). The GML Property geometry is therefore contained in this namespace.

A compliant WFS expects that all elements that refer to a GML Application Schema are also specified in this namespace in the GetFeature-Request. This can be done either by a prefix (in the example ave:geometrie) or by using the default namespace (geometrie). In the first case, the ave prefix has to be defined in the WFS request (xmlns:ave="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0"). In the latter case, the default namespace would have to be defined in the WFS request (xmlns="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0").

Note that the property geometrie is used in two places in the request: In wfs:PropertyName (Web Feature Service) and in ogc:PropertyName (Filter Encoding).

However, according to the OGC specification WFS 1.1, wfs:PropertyName is a QName [1]. Therefore, the GML Property has to belong to a specific namespace (which can be done either via a prefix or via default namespace). Since the property geometrie refers to no namespace, the observed exception occurs at this point.

In the case of the second element, ogc:PropertyName, according to the schema (Filter Encoding 1.1 [2]) it would not necessarily have to be a QName, but the description in the OGC specification for Filter Encoding 1.1 can also be interpreted in such a way that a QName is expected here. In the implementation of the remote WFS, a uniform behaviour analogous to wfs:PropertyName was chosen. So the WFS also expects a QName in ogc:PropertyName.

One could perhaps theoretically adapt the remote WFS so that it would be more fault-tolerant in some very simple cases. But it could work only for ogc:PropertyName. wfs:PropertyName must still be a valid QName (incorrent values are already recognised and rejected by the XML parser).

On the other hand, the solution for correcting the request would be simple:

  • Add default namespace to the root element wfs:GetFeature (xmlns="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0"). Alternatively, adding the default namespace to wfs:Query or both wfs:PropertyName and ogc:PropertyName would also work.
    • Doing so you can use geometrie without prefix.
  • Or add the prefix ave to the property names (ave:geometry).
  • Or omit the two elements wfs:PropertyName and ogc:PropertyName with geometrie.

References:

3
  • That's all exactly what I would expect but how is a client supposed to work that out from the XSD you are sending in the DescribeFeatureType response?
    – Ian Turton
    Commented Aug 24, 2021 at 9:41
  • I think we need to take this discussion to the GeoServer devel list - One or other of us is interpreting the standard wrongly - It would be good to get to the bottom of it and if it's me then I can look at fixing GeoServer.
    – Ian Turton
    Commented Aug 30, 2021 at 13:11
  • I talked to the guy behind the LGB-account as I contacted him via mail and he just updated the thread to let us know. But he told me that he has not enough resources to discuss this topic further.
    – Felix
    Commented Aug 31, 2021 at 5:23
2

There is currently no way to control the XML that GeoServer sends to the remote WFS as it is generated on the fly with each request.

The main problem is that the remote server is broken in that it reports with a DescribeFeatureType request that there is a geometry called geometrie

<?xml version="1.0"?>                                                                                                   
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" xmlns:ave="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0" targetNamespace="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0" elementFormDefault="qualified">
  <import namespace="http://www.opengis.net/gml" schemaLocation="https://isk.geobasis-bb.de/schema/ogc/gml/3.1.1/base/gml.xsd"/>
  <element name="Flurstueck" substitutionGroup="gml:_Feature" type="ave:FlurstueckType"/>                               
  <complexType name="FlurstueckType">                                                                                   
    <complexContent>                                                                                                    
      <extension base="gml:AbstractFeatureType">                                                                        
        <sequence>                                                                                                      
          <element name="idflurst" type="string"/>                                                                      
          <element name="flstkennz" type="string"/>                                                                     
          <element name="land" type="string"/>                                                                          
          <element name="landschl" type="string"/>                                                                      
          <element name="gemarkung" type="string"/>                                                                     
          <element name="gemaschl" type="string"/>                                                                      
          <element minOccurs="0" name="flur" type="string"/>                                                            
          <element minOccurs="0" name="flurschl" type="string"/>                                                        
          <element name="flstnrzae" type="string"/>                                                                     
          <element minOccurs="0" name="flstnrnen" type="string"/>                                                       
          <element minOccurs="0" name="regbezirk" type="string"/>                                                       
          <element minOccurs="0" name="regbezschl" type="string"/>                                                      
          <element minOccurs="0" name="kreis" type="string"/>                                                           
          <element name="kreisschl" type="string"/>                                                                     
          <element name="gemeinde" type="string"/>                                                                      
          <element name="gmdschl" type="string"/>                                                                       
          <element name="oid" type="string"/>                                                                           
          <element name="aktualit" type="date"/>                                                                        
          <element name="geometrie" type="gml:MultiSurfacePropertyType"/>                                               
          <element name="flaeche" type="double"/>                                                                       
          <element minOccurs="0" name="abwrecht" type="string"/>                                                        
          <element name="lagebeztxt" type="string"/>                                                                    
          <element minOccurs="0" name="tntxt" type="string"/>                                                           
        </sequence>                                                                                                     
      </extension>                                                                                                      
    </complexContent>                                                                                                   
  </complexType>                                                                                                        
</schema>

But when we send a valid and well formed GetFeature request

<?xml version="1.0"?>                                                                                                   
  fs:GetFeature xmlns:ave="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0" xmlns:xs="http://ww.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" handle="GeoTools 25.2(32b29a7fdc97df169ac04379b2f37923a4bdad67) WFS 1.1.0 DataStore @astun-desktop#1" outputFormat="text/xml;  subtype=gml/3.1.1" resultType="results" service="WFS" version="1.1.0">
  <wfs:Query srsName="urn:ogc:def:crs:EPSG::25833" typeName="ave:Flurstueck">                                           
    <wfs:PropertyName>geometrie</wfs:PropertyName>                                                                      
    <ogc:Filter>                                                                                                        
      <ogc:BBOX>                                                                                                        
        <ogc:PropertyName>geometrie</ogc:PropertyName>                                                                  
        <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#25833">                         
          <gml:lowerCorner>-338389.674795 5726973.750634</gml:lowerCorner>                                              
          <gml:upperCorner>604703.570481 6616308.827432</gml:upperCorner>                                               
        </gml:Envelope>                                                                                                 
      </ogc:BBOX>                                                                                                       
    </ogc:Filter>                                                                                                       
  </wfs:Query>                                                                                                          
</wfs:GetFeature>

It responds claiming to need a prefix on the geometrie property name.

<ExceptionReport 
    version="1.1.0"
    xmlns="http://www.opengis.net/ows"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://www.opengis.net/ows https://isk.geobasis-bb.de/schema/ogc/ows/1.0.0/owsExceptionReport.xsd">
    <Exception exceptionCode="ErrorInPropertyName" locator="GeoTools 25.2(32b29a7fdc97df169ac04379b2f37923a4bdad67) WFS 1.1.0 DataStore @astun-desktop#1">
        <ExceptionText>
            Request rejected due to errors.
            InternalExceptionCode: iiErrorInPropertyName.  
            Reason: 
<![CDATA[
Prefix '' in qname 'geometrie' is unknown (FeatureTypeContext: ave:Flurstueck).
]]>
        </ExceptionText>
    </Exception>
</ExceptionReport>

Update

I've also tried with a targetNamespace="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0" added to the GetFeature request, still no luck.

<?xml version="1.0"?>                                                                                                   
<wfs:GetFeature xmlns:ave="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0" xmlns:xs="http://ww.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" targetNamespace="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0" handle="GeoTools 25.2(32b29a7fdc97df169ac04379b2f37923a4bdad67) WFS 1.1.0 DataStore @astun-desktop#1" outputFormat="text/xml;  subtype=gml/3.1.1" resultType="results" service="WFS" version="1.1.0">
  <wfs:Query srsName="urn:ogc:def:crs:EPSG::25833" typeName="ave:Flurstueck">                                           
    <wfs:PropertyName>geometrie</wfs:PropertyName>                                                                      
    <ogc:Filter>                                                                                                        
      <ogc:BBOX>                                                                                                        
        <ogc:PropertyName>geometrie</ogc:PropertyName>                                                                  
        <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#25833">                         
          <gml:lowerCorner>-338389.674795 5726973.750634</gml:lowerCorner>                                              
          <gml:upperCorner>604703.570481 6616308.827432</gml:upperCorner>                                               
        </gml:Envelope>                                                                                                 
      </ogc:BBOX>                                                                                                       
    </ogc:Filter>                                                                                                       
  </wfs:Query>                                                                                                          
</wfs:GetFeature>

gives me:

<?xml version="1.0" encoding="utf-8" ?>
<ExceptionReport 
    version="1.1.0"
    xmlns="http://www.opengis.net/ows"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://www.opengis.net/ows https://isk.geobasis-bb.de/schema/ogc/ows/1.0.0/owsExceptionReport.xsd">
    <Exception exceptionCode="InvalidParameterValue" locator="unknown">
        <ExceptionText>
            Request rejected due to errors.
            InternalExceptionCode: iiWFSSyntaxErrors.  
            Reason: 
<![CDATA[
WFS request is incorrect:
Error, line 1, column 649
Message: attribute 'targetNamespace' is not declared for element 'GetFeature'
Parsing finished with errors.

]]>
        </ExceptionText>
    </Exception>
</ExceptionReport>
2
  • Thanks for the insight, so there is no way I can manually change this. Do you happen to know if this is a lot of work for the guys setting up the WFS? (Probably depending on how it is produced)
    – Felix
    Commented Aug 12, 2021 at 18:08
  • Hey @Ianturton, can you check the reply below and maybe see if you know something that would help me?
    – Felix
    Commented Aug 24, 2021 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.