Try changing your URL to have "&VERSION=1.0".
Jody
On 03/09/2009, at 6:10 PM, Julian Hagenauer wrote:
> Hi,
> sorry for spaming the list with my problems, but after fiddling some
> hours with my code, i made no further progress myself solving the
> problem.
> So, this is my code:
>
> URL url = new
> URL("http://localhost/geoserver/wfs?request=getCapabilities&srs=EPSG:4326
> ");
> Map<String, Serializable> m = new HashMap<String, Serializable>();
> m.put(WFSDataStoreFactory.URL.key, url);
> m.put(WFSDataStoreFactory.TIMEOUT.key, 30000);
> m.put(WFSDataStoreFactory.MAXFEATURES.key, 10);
>
> DataStore wfs = (new WFSDataStoreFactory()).createDataStore(m);
> Query query = new DefaultQuery(wfs.getTypeNames()[i], bbox, new
> String[] "osm_id","name"} );
> FeatureReader ft = wfs.getFeatureReader(query,
> Transaction.AUTO_COMMIT);
>
> I am trying to access my WFS, explicitly requesting only the ids and
> names of the features.
>
> This is what java gave me back:
> 03.09.2009 09:46:02 org.geotools.data.wfs.WFSDataStoreFactory
> determineCorrectStrategy
> INFO: Using WFS Strategy:
> org.geotools.data.wfs.v1_1_0.GeoServerStrategy
> 03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor
> visit
> WARNUNG: results[ class java.lang.String ] is not of type class
> net.opengis.wfs.ResultTypeType
> 03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor
> visit
> WARNUNG: Binding: {http://www.opengis.net/ows}ServiceType does not
> declare a target type
> 03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor
> visit
> WARNUNG: Binding: {http://www.opengis.net/wfs}Base_TypeNameListType
> does not declare a target type
> 03.09.2009 09:46:02 org.geotools.xml.impl.AttributeEncodeExecutor
> visit
> WARNUNG: Binding: {http://www.opengis.net/wfs}TypeNameListType does
> not declare a target type
> DecribeFT URL for osm_auto:points:
> http://localhost/geoserver/wfs?=&TYPENAME=osm_auto%3Apoints&VERSION=1.1.0&SERVICE=WFS&REQUEST=DescribeFeatureType&NAMESPACE=xmlns%28osm_auto%3Dhttp%3A%2F%2Ffoo_domain%2Fkarto%2Fosm_auto%29&
> java.lang.NullPointerException: PropertyDescriptor is null - did you
> request a property that does not exist?
> at org.geotools.feature.type.ComplexTypeImpl.<init>
> (ComplexTypeImpl.java:71)
> at org.geotools.feature.type.FeatureTypeImpl.<init>
> (FeatureTypeImpl.java:50)
> at org.geotools.feature.simple.SimpleFeatureTypeImpl.<init>
> (SimpleFeatureTypeImpl.java:55)
> at
> org.geotools.feature.type.FeatureTypeFactoryImpl.createSimpleFeatureType
> (FeatureTypeFactoryImpl.java:154)
> at
> org.geotools.feature.simple.SimpleFeatureTypeBuilder.buildFeatureType
> (SimpleFeatureTypeBuilder.java:850)
> at org.geotools.data.DataUtilities.createSubType(DataUtilities.java:
> 1303)
> at
> org.geotools.data.wfs.v1_1_0.parsers.FeatureCollectionParser.parse
> (FeatureCollectionParser.java:65)
> at org.geotools.data.wfs.protocol.wfs.WFSExtensions.process
> (WFSExtensions.java:75)
> at org.geotools.data.wfs.v1_1_0.WFS_1_1_0_DataStore.getFeatureReader
> (WFS_1_1_0_DataStore.java:325)
> at myprog.loadFeaturesFromWFS(MyProg.java:94)
>
> So, basically it says, that there is no property called name. I
> sniffed the network traffic and this is the schema, that is returend
> to geotools during the request:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:gml="http://www.opengis.net/gml
> " xmlns:osm_auto="http://foo_domain/karto/osm_auto"
> elementFormDefault="qualified"
> targetNamespace="http://foo_domain/karto/osm_auto
> ">
> <xsd:import namespace="http://www.opengis.net/gml"
> schemaLocation="http://localhost:80/geoserver/schemas/gml/3.1.1/base/gml.xsd
> "/>
> <xsd:complexType name="pointsType">
> <xsd:complexContent>
> <xsd:extension base="gml:AbstractFeatureType">
> <xsd:sequence>
> <xsd:element maxOccurs="1" minOccurs="0" name="osm_id"
> nillable="true" type="xsd:int"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="name"
> nillable="true" type="xsd:string"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="type"
> nillable="true" type="xsd:string"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="public_tran"
> nillable="true" type="xsd:string"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="amenity"
> nillable="true" type="xsd:string"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="shop"
> nillable="true" type="xsd:string"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="tourism"
> nillable="true" type="xsd:string"/>
> <xsd:element maxOccurs="1" minOccurs="0" name="the_geom"
> nillable="true" type="gml:PointPropertyType"/>
> </xsd:sequence>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
> <xsd:element name="points" substitutionGroup="gml:_Feature"
> type="osm_auto:pointsType"/>
> </xsd:schema>
>
> So, the schema does explicity state that there is a property called
> "name". Any idea whats wrong?
>
> Thank you very much,
> Julian
>
> --
> Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla
> Firefox 3 -
> sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users