I am trying to access a WFS using geotools. Access is working with version 1.0.0 and 1.1.0 without problems. Here my code:
// Conenction
String getCapabilities = WFSDataStoreFactory.createGetCapabilitiesRequest(new URL("http://demo.opengeo.org/geoserver/wfs"), new Version("2.0.0")).toString();
Map connectionParameters = new HashMap();
connectionParameters.put(WFSDataStoreFactory.URL.key, getCapabilities);
WFSDataStoreFactory dsf = new WFSDataStoreFactory();
WFSDataStore dataStore = dsf.createDataStore(connectionParameters);
// Layer
SimpleFeatureSource source = dataStore.getFeatureSource("maps:ne_10m_lakes");
// Features
SimpleFeatureCollection fc = source.getFeatures();
SimpleFeatureIterator iterator = fc.features();
while (iterator.hasNext()) {
SimpleFeature sf = iterator.next();
// dostuff
}
Using version 2.0.0 results in:
Can't find a response parser factory for DESCRIBE_FEATURETYPE/'application/xml' Failed to execute request http://demo.opengeo.org:80/geoserver/wfs?REQUEST=DescribeFeatureType&VERSION=2.0.0&SERVICE=WFS Exception in thread "main" org.geotools.factory.FactoryNotFoundException: Can't find a response parser factory for DESCRIBE_FEATURETYPE/'application/xml' at org.geotools.data.wfs.internal.WFSExtensions.findResponseFactory(WFSExtensions.java:106) at org.geotools.data.wfs.internal.WFSRequest.createResponse(WFSRequest.java:205) at org.geotools.data.wfs.internal.WFSRequest.createResponse(WFSRequest.java:38) at org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOpenWebService.java:445) at org.geotools.data.wfs.internal.WFSClient.internalIssueRequest(WFSClient.java:292) at org.geotools.data.wfs.internal.WFSClient.issueRequest(WFSClient.java:354) at org.geotools.data.wfs.WFSDataStore.getRemoteFeatureType(WFSDataStore.java:210) at org.geotools.data.wfs.WFSDataStore.getRemoteSimpleFeatureType(WFSDataStore.java:264) at org.geotools.data.wfs.WFSFeatureSource.buildFeatureType(WFSFeatureSource.java:348) at org.geotools.data.store.ContentFeatureSource.getAbsoluteSchema(ContentFeatureSource.java:356) at org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:325) at org.geotools.data.store.ContentFeatureCollection.(ContentFeatureCollection.java:80) at org.geotools.data.store.ContentFeatureSource.getFeatures(ContentFeatureSource.java:583) at org.geotools.data.store.ContentFeatureSource.getFeatures(ContentFeatureSource.java:114) at TestWFS.main(TestWFS.java:79)
Any suggestions?