From: Gerson G. <ger...@gm...> - 2011-10-20 05:52:45
|
Hi, I've been using the WFS plugin ( http://docs.geotools.org/latest/userguide/library/data/wfs.html) to run getCapabilities, describeFeatureType and getFeature request against our local geoserver. It was all working fine until I started talking to a WFS that requires authentication. I added the WFSDataStoreFactory:USERNAME and WFSDataStoreFactory:PASSWORD to the list of connectionParameters but the query only worked for getCapabilities and describeFeatureType requests. Do I need to do anything special if I am to run a getFeature request requiring authentication? Here's how my code looks like at the moment... String getCapabilitiesURL = " > https://www2.landgate.wa.gov.au/ows/wfsabs_4283/wfs?service=wfs&version=1.0.0&request=GetCapabilities > "; > > Map connectionParameters = new HashMap(); > > connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL", > getCapabilitiesURL); > connectionParameters.put("WFSDataStoreFactory:USERNAME", > wfsUsername); > connectionParameters.put("WFSDataStoreFactory:PASSWORD", > wfsPassword); > > // getCapabilities... > DataStore data = > DataStoreFinder.getDataStore(connectionParameters); > > // describeFeatureType... > SimpleFeatureType schema = data.getSchema("slip:ABS-030"); > String geomName = schema.getGeometryDescriptor().getLocalName(); > > // getFeature... > SimpleFeatureSource source = data.getFeatureSource("slip:ABS-030"); > SimpleFeatureCollection features = source.getFeatures(); > SimpleFeatureIterator iter = features.features(); > > // after executing features.feature() above, it throws > // WARNING: java.io.IOException: java.io.IOException: Server > returned HTTP response code: 401 for URL: > https://www2.landgate.wa.gov.au/ows/wfsabs_4283/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=slip:ABS-030 > > > Thanks, Gerson |