[geotk] Request WFS-Server
Hebler, Christoph
christoph.hebler at atos.net
Fri Aug 11 03:19:10 PDT 2017
Hello,
I am still trying to request one special "typename" from a given WFS-Server, but I am not able to get it.
Maybe someone of you is so kind to give me a working example?
Situation:
- using geotoolkit version 4.0.3
- trying to request a WFS-Server
- (if possible: using HTTP POST to request)
Since this is a free WFS and in SoapUI this request works, maybe this Request can be used as example:
http://sla.niedersachsen.de/landentwicklung/land-d3/services?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=app:verfahrensart_ab
My _not working_ Java-Code for this example:
public static void main(String[] args) throws MalformedURLException, DataStoreException, CQLException {
final URL url = new URL("http://sla.niedersachsen.de/landentwicklung/land-d3/services");
final FeatureStore store = new WebFeatureClient(url, "1.1.0");
for (GenericName name : store.getNames()) {
final org.opengis.filter.Filter filter = CQL.parseFilter("TYPENAME = app:verfahrensart_ab");
final Query query = QueryBuilder.filtered(name,filter);
final FeatureReader reader = store.getFeatureReader(query);
while (reader.hasNext()) {
final Feature feature = reader.next();
System.out.println(feature);
}
reader.close();
}
}
If I execute this code there comes a quit long list of warnings, ending with this exception:
Aug 11, 2017 12:02:49 PM org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader listFeatureTypes
WARNUNG: null typeName for element : _Object
Aug 11, 2017 12:02:50 PM org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader listFeatureTypes
WARNUNG: null typeName for element : isSphere
Aug 11, 2017 12:02:50 PM org.geotoolkit.data.wfs.WFSFeatureStore requestFeature
INFORMATION: [WFS Client] request feature : http://sla.niedersachsen.de/landentwicklung/land-d3/services?NAMESPACE=xmlns%28app%3Dhttp%3A%2F%2Fwww.opengis.net%2Fgml%29&FILTER=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22+standalone%3D%22yes%22%3F%3E%0A%3Cogc%3AFilter+xmlns%3Ans6%3D%22http%3A%2F%2Fwww.opengis.net%2Fgml%2F3.2%22+xmlns%3Ase%3D%22http%3A%2F%2Fwww.opengis.net%2Fse%22+xmlns%3Agml%3D%22http%3A%2F%2Fwww.opengis.net%2Fgml%22+xmlns%3Asld%3D%22http%3A%2F%2Fwww.opengis.net%2Fsld%22+xmlns%3Aogc%3D%22http%3A%2F%2Fwww.opengis.net%2Fogc%22+xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%0A++%3Cogc%3APropertyIsEqualTo%3E%0A++++%3Cogc%3APropertyName%3ETYPENAME%3C%2Fogc%3APropertyName%3E%0A++++%3Cogc%3APropertyName%3Eapp%3Averfahrensart_ab%3C%2Fogc%3APropertyName%3E%0A++%3C%2Fogc%3APropertyIsEqualTo%3E%0A%3C%2Fogc%3AFilter%3E%0A&TYPENAME=app%3AAbstractFeatureCollection&REQUEST=GETFEATURE&VERSION=1.1.0&SERVICE=WFS
Exception in thread "main" java.lang.IllegalArgumentException: The xml does not describe the same type of feature:
Expected: http://www.opengis.net/gml:AbstractFeatureCollection
But was: http://www.opengis.net/ows:ExceptionReport
at org.geotoolkit.feature.xml.jaxp.JAXPStreamFeatureReader.read(JAXPStreamFeatureReader.java:258)
at org.geotoolkit.feature.xml.jaxp.JAXPStreamFeatureReader.read(JAXPStreamFeatureReader.java:169)
at org.geotoolkit.data.wfs.WFSFeatureStore.requestFeature(WFSFeatureStore.java:534)
at org.geotoolkit.data.wfs.WFSFeatureStore.getFeatureReader(WFSFeatureStore.java:322)
at org.geotoolkit.data.wfs.WebFeatureClient.getFeatureReader(WebFeatureClient.java:365)
at test.main.main(main.java:63)
I do not have any experience with dealing with geo-data and no experience with the geotoolkit. So it would really be a tremendous help if one of you could adapt the above code so that it works.
Thanks a lot in advance for your help!
Kind regards,
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20170811/5f7d343a/attachment-0001.html>
More information about the Geotoolkit
mailing list