Hello geotools community,

I think I discovered a bug in the wfs implementation of geotools.


This method call fails with the following error:
org.geotools.data.wfs.WFSFeatureSource#getReader()

java.lang.RuntimeException: java.io.IOException: Server returned HTTP response 
code: 400 for URL: 
http://server/path/wfs?REQUEST=DescribeFeatureType&VERSION=2.0.0&SERVICE=WFS


This happens only with certain WFS-Servers. We tracked down the problem to this 
POST-Request, that is generated from geotools:

Works not:
curl -X POST -i 
'http://server/path/wfs?REQUEST=DescribeFeatureType&VERSION=2.0.0&SERVICE=WFS' 
--data '<?xml version="1.0" encoding="UTF-8"?><wfs:DescribeFeatureType 
xmlns:ave="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0";
 xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:fes="http://www.opengis.net/fes/2.0"; 
xmlns:wfs="http://www.opengis.net/wfs/2.0"; 
xmlns:gml="http://www.opengis.net/gml/3.2"; 
xmlns:ows="http://www.opengis.net/ows/1.1"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; handle="GeoTools 
18.0(3f5dbf634c4a6b24476643cc7cf7d2b22747fcf5) WFS 2.0.0 DataStore 
@LDBV-M-W0378#1" outputFormat="application/gml+xml; version=3.2" service="WFS" 
version="2.0.0">
 <wfs:TypeName>ave:Flurstueck</wfs:TypeName>
</wfs:DescribeFeatureType>'

Works:
curl -X POST -i 'http://server/path/wfs' --data '<?xml version="1.0" 
encoding="UTF-8"?><wfs:DescribeFeatureType 
xmlns:ave="http://repository.gdi-de.org/schemas/adv/produkt/alkis-vereinfacht/2.0";
 xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:fes="http://www.opengis.net/fes/2.0"; 
xmlns:wfs="http://www.opengis.net/wfs/2.0"; 
xmlns:gml="http://www.opengis.net/gml/3.2"; 
xmlns:ows="http://www.opengis.net/ows/1.1"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; handle="GeoTools 
18.0(3f5dbf634c4a6b24476643cc7cf7d2b22747fcf5) WFS 2.0.0 DataStore 
@LDBV-M-W0378#1" outputFormat="application/gml+xml; version=3.2" service="WFS" 
version="2.0.0">
 <wfs:TypeName>ave:Flurstueck</wfs:TypeName>
</wfs:DescribeFeatureType>'

The "works not" Request is the one produced by geotools. This happens also with 
the actual release of geotools. The "works" Request is a OGC conform Request.


I tracked down the class, that makes the problem. It is the class 
org.geotools.data.wfs.internal.WFSRequest in the unsupported module gt-wfs-ng. 
The problem lies in the construktor, where it says:


        setProperty(SERVICE,"WFS");


setProperty(VERSION, strategy.getVersion());


setProperty(REQUEST, operation.getName());



This properties should only be set, if this.doPost is false, because otherwise 
the method getFinalURL() delivers a URL with Key-Value-Pairs, even if it is a 
POST-Request. And this causes this problem with certain WFS-Servers.


What do you think about this? And could you be able to fix this bug?


Greatings,
Matthias Schulze (matthias24 on github)





Mit freundlichen Grüßen
Matthias Schulze

--
Matthias Schulze
Landesamt für Digitalisierung, Breitband und Vermessung
Alexandrastraße 4, 80538 München
Adressansicht im 
BayernAtlas<http://geoportal.bayern.de/bayernatlas?Y=4469627&X=5333820&zoom=13&crosshair=marker>

Telefon: +49 (89) 2129 1561
E-Mail: matthias.schu...@ldbv.bayern.de<mailto:matthias.schu...@ldbv.bayern.de>
Internet: http://www.geodaten.bayern.de<http://www.geodaten.bayern.de/>



_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to