Hi Gerson,

As you see, you get a HTTP 401 (Unauthorized). If I open the url you provided 
in the Error message, a login window pops-up... Geotools can't access that url 
because of the Login.

Roy
  _____  

From: Gerson Galang [mailto:[email protected]]
To: [email protected]
Sent: Mon, 12 Mar 2012 07:21:00 +0100
Subject: [Geotools-gt2-users] getFeatures requests failing with WFS 1.0.0 
servers

Hi,


I briefly touched on this topic last time and I was wondering if you have any 
plans of supporting getFeatures queries on WFS 1.0.0 services. 


The problem I have is when I try to access WFS 1.0.0, I get the exceptino 
below..   



12/03/2012 4:59:43 PM org.geotools.data.wfs.v1_0_0.NonStrictWFSStrategy 
createFeatureReaderPOST
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-073
  
12/03/2012 4:59:44 PM org.geotools.data.wfs.v1_0_0.NonStrictWFSStrategy 
createFeatureReaderGET
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-073
  


Here's my code:



        try {
            Query query = new Query(getName());
            if (filter != null) {
                query.setFilter(filter);  
            }
            if (propertyNames != null && propertyNames.length > 0) {
                query.setPropertyNames(propertyNames);
            }


              DataStore dataStore = (DataStore) featureSource.getDataStore();
            if (dataStore instanceof WFSDataStore) {
                WFSDataStore wfsDataStore = (WFSDataStore) dataStore;  
                try {
                    // when this doesn't throw an exception, it means
                    // we're using WFS version > 1.0.0
                    wfsDataStore.getServiceVersion();  
                    LOGGER.debug("Using getFeature 1.1.0");


                } catch (UnsupportedOperationException e) {
                    // this exception is usually thrown when we're trying to 
talk to WFS 1.0.0  
                    // at the moment, geotools WFS Plugin only supports WFS 
1.1.0.
                    LOGGER.debug("Using getFeature 1.0.0");
                }
            }  


            return featureSource.getFeatures(query);

        } catch (IOException e) {
            LOGGER.error("IOException was thrown while calling getFeatures!");  
            return null;
        }


The code works if I talk to a WFS 1.1.0 service. Upgrading the remote geoserver 
is also not an option as the server runs outside of our domain.  


Do you have any suggestions on how I can handle getFeatures queries on WFS 
1.0.0 services?


Thanks,
Gerson      
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to