Hi there,

*TL;DR*
        - Using Geotools 18.1
        - GetCapabilities: ows:Parameter "outputFormat" and "srsName" could not 
be found within ows:Operation (because it is allowed to place them next to 
ows:Operation)
        - Simple maven project attached

I try to use a public WFS service in version 2.0.0 and have problems while 
simply retrieving some features. The java code below leads to an exception 
"java.lang.IllegalArgumentException: Client does not support any of the server 
supported output formats for DESCRIBE_FEATURETYPE".
I tracked it down to a new (WFS 2.0.0) optional structure in the 
GetCapabilities document, by which it is possible to locate the ows:Parameters 
next to ows:Operation instead of a nested element within the ows:Operation. 
(OpenGIS Web Feature Service 2.0 Interface Standard (also ISO 19142) - 
http://portal.opengeospatial.org/files/?artifact_id=39967 or 
http://www.opengeospatial.org/standards/wfs ) chapter  8.3.5.1 page 49 ).
Calling the service with version=2.0.0 (in code [1]) it delivers a valid 
GetCapabilities document with this optional format, which leads to the 
mentioned exception above, because the "outputFormat" and later the "srsName" 
couldn't be found at the expected position, see XML snippet below.

Did I miss any tweaks or options to make it work or is this a known issue I 
have to treat?

----JAVA---------------------------------
public class WfsTestApp {
       public static void main(String[] args) throws Exception {
             String getCapabilities = 
"http://isk.geobasis-bb.de/ows/dog_lgb200_bebb_v3?SERVICE=WFS&REQUEST=GetCapabilities&ACCEPTVERSIONS=";;

             getCapabilities += "2.0.0"; // [1]
             // getCapabilities += "1.1.0"; // [2]

             DataStore data = 
DataStoreFinder.getDataStore(Collections.singletonMap("WFSDataStoreFactory:GET_CAPABILITIES_URL",
 getCapabilities));

             String typeName = "dog:Strassen";
             Query q = new Query(typeName);
             q.setMaxFeatures(5);

             SimpleFeatureCollection features = 
data.getFeatureSource(typeName).getFeatures(q);
             System.out.println("Size: " + features.size()); // expected 5 but 
was 51331 ... anyway! [4]

             try (SimpleFeatureIterator iter = features.features()) {
                    while (iter.hasNext()) {
                           System.out.println(iter.next());
                    }
             }
       }
}
----JAVA---------------------------------

----XML---------------------------------
<WFS_Capabilities version="2.0.0" xmlns="http://www.opengis.net/wfs/2.0"; 
xmlns:ows="http://www.opengis.net/ows/1.1"; >
  <!-- ... -->
  <ows:OperationsMetadata>
    <ows:Operation name="GetCapabilities"><!-- ... --></ows:Operation>
    <ows:Operation name="DescribeFeatureType">
      <ows:DCP><!-- ... --></ows:DCP>
      <!-- the current implementation is looking here for the parameter 
*outputFormat* and does not fall back to "globally" defined parameters -->
    </ows:Operation>
    <ows:Operation name="GetFeature">
      <ows:DCP><!-- ... --></ows:DCP>
      <!-- the current implementation is looking here for the parameters 
*outputFormat* and *srsName* -->
    </ows:Operation>
    <ows:Parameter name="version">
      <ows:AllowedValues>
        <ows:Value>2.0.0</ows:Value>
        <ows:Value>1.1.0</ows:Value>
      </ows:AllowedValues>
    </ows:Parameter>
    <ows:Parameter name="srsName"> <!-- "globally" defined -->
      <ows:AllowedValues>
        <ows:Value>urn:ogc:def:crs:EPSG::4326</ows:Value>
        <!-- ... -->
      </ows:AllowedValues>
    </ows:Parameter>
    <ows:Parameter name="outputFormat"> <!-- "globally" defined -->
      <ows:AllowedValues>
        <ows:Value>text/xml; subtype=gml/3.2.1</ows:Value>
        <ows:Value>text/xml; subtype="gml/3.2.1"</ows:Value>
        <!-- ... -->
      </ows:AllowedValues>
    </ows:Parameter>
    <!-- ... -->
  </ows:OperationsMetadata>
  <!-- ... -->
</WFS_Capabilities>
----XML---------------------------------


Using version 1.1.0 as workaround is not an option because I want to use a 
server-side function called "normalize" to generate the second input parameter 
for the PropertyIsLike filter. 

For a quick replay of these issue, I attached a small maven project (7zip 
archive; zip: https://ufile.io/jrof4 ). I use Geotools 18.1, Java 8 and Maven 
3.3.3.

I hope somebody can help me make it work. Thanks in advance.

Yours sincerely.

M.Sc. Robin Pradel
Senior Software Engineer
IVU Traffic Technologies AG
Bundesallee 88, D-12161 Berlin
http://www.ivu.de

Attachment: geotools-wfs2-test.7z
Description: geotools-wfs2-test.7z

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to