Hello Hanane, and welcome!
I'm not familiar myself on the WFS part, since Apache SIS is just
starting to support its first web services (through Hao's work in Google
Summer of Code). But I will try to get a Geotk developer to answer your
question. I may not be able to reach them before Monday however.
Regards,
Martin
Le 30/07/16 à 16:58, Hanane Eljabiri a écrit :
>
> Hello everyone,
>
> I am a new user of this library and I have some difficulties to get
> familiar with it.
>
> My first question is: how can I get features from a wfs response using
> SIS (Gtk) library?
>
> I’ve tried to create a new WFS client, but unfortunately I didn’t find
> neither tutorials nor examples showing how to do this.
>
> So I tried the following code :
>
> URL url=*new*URL("http://geoservices.brgm.fr/geologie?service=wfs");
> WebFeatureClient _wfs_=new WebFeatureClient(_url_, "1.1.0");
> String [] names=wfs.getTypeNames();
>
> With the code below, I’ve got the following exceptions:
>
>
> Avertissement: JAXB exception while reading imported
> schema:http://schemas.opengeospatial.net/gml/3.1.1/base/gml.xsd
> _javax.xml.bind.UnmarshalException_
> - with linked exception:
> [org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 55; Des
> espaces sont obligatoires entre les ID publicId et systemId.]
> at
> javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(_AbstractUnmarshallerImpl.java:335_)
> …
> Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber:
> 55; Des espaces sont obligatoires entre les ID publicId et systemId.
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(_ErrorHandlerWrapper.java:198_)
> ... 18 more
> juil. 30, 2016 4:33:45 PM org.geotoolkit.feature.xml.Utils
> getDistantSchema
> Avertissement: Schema ressource not
> found:http://schemas.opengeospatial.net/gml/3.1.1/base/gml.xsd
> juil. 30, 2016 4:33:45 PM
> org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader listAllSchemas
> Avertissement: Unable to retrieve imported
> schema:http://schemas.opengeospatial.net/gml/3.1.1/base/gml.xsd
> Exception in thread "main"
> _org.opengis.feature.MismatchedFeatureException_: Unable to find
> complex type for name :
> {http://www.opengis.net/gml}AbstractFeatureType
> <http://www.opengis.net/gml%7DAbstractFeatureType>
> at
> org.geotoolkit.feature.xml.jaxb.JAXBFeatureTypeReader.getType(_JAXBFeatureTypeReader.java:611_)
>
> …
>
>
>
> I’ve tried another way to get a response from the wfs server using the
> following code:
>
>
> URL url=*new*URL("http://geoservices.brgm.fr/geologie?service=wfs");
> *final*Iterator<ClientFactory> ite=
> DataStores./getAllFactories/(ClientFactory.*class*).iterator();
> *while*(ite.hasNext()) {
> * final*ClientFactory factory= ite.next();
> * final*ParameterDescriptorGroup description=
> factory.getParametersDescriptor();
> * final*ParameterValueGroup params= description.createValue();
> params.parameter("identifier").setValue("wfs");
> params.parameter("url").setValue(url);
> params.parameter("version").setValue("1.1.0");
> * final*DataStore _server_= factory.create(params);
> }
>
> Using the code above, I’ve got the following error:
>
>
> Exception in thread "main"
> _org.apache.sis.storage.DataStoreException_: Can not create any new
> WFS DataStore
> at
> org.geotoolkit.data.wfs.WFSFeatureStoreFactory.create(_WFSFeatureStoreFactory.java:144_)
> at
> org.geotoolkit.data.wfs.WFSFeatureStoreFactory.create(_WFSFeatureStoreFactory.java:46_)
>
> My second question is : Does the library support the version 2.0.0 of
> wfs? I tried to specify in parameters shown above the value “2.0.0”
> but I’ve got an error saying : “2.0.0” is an unknow version value!
>
> I am using java7 and this is an extract from my POM.xml:
>
> <properties>
> <geotk.version>4.0-M5</geotk.version>
> </properties>
> <dependencies>
> <dependency>
> <groupId>org.geotoolkit</groupId>
> <artifactId>_geotk_-referencing</artifactId>
> <version>${geotk.version}</version>
> </dependency>
> <dependency>
> <groupId>org.geotoolkit</groupId>
> <artifactId>_geotk_-client-_wfs_</artifactId>
> <version>${geotk.version}</version>
> </dependency>
> </dependencies>
> <repositories>
> <repository>
> <id>_geotoolkit_</id>
> <name>_Geotk_repository</name>
> <url>http://maven.geotoolkit.org</url>
> </repository>
> </repositories>
> </project>
>
> Thank you,
>
> Best regards
>