From: Justin D. <jde...@un...> - 2005-12-12 17:33:01
|
ispace (sent by Nabble.com) wrote: > Hello, > > I'm trying to connect to a WFS Server (GeoServer 1.3 RC6) from a Java > class by using geotools 2.1.0. > > *1.) *I can read the properties of a shape file, but when I try to > access an SDE via the GeoServer, I get the error described below. Can > the reason for the exception be that the FeatureType String contains a > "." (dot) for separating user name, database and feature class? > So if I understand correctly, you have your data in an arc sde database? I am not familiar with SDE, does the dot denote some sort of schema, or is it just the name of a table in this case? > *2.)* In the procedure described above, the used namespace is "ispace" > and the datastore is "ispace_ms". The error message changes, if the > namespace equals the datastore (see second error message below). > * > 3.)* At the moment, I'm accessing the WFS via a GetCapabilities Request > and then extracting the features "by hand". Is there a possibility to > send a GetFeature Request and directly access the returned features as > "elements" (such as GML, etc.). My code is posted in "ad 3.)" below. You can use the geotools WFS reading code. Hopefully there is a tutorial around somewhere. If you also post this one to the geotools-users list you should get a good answer. Sorry I cant be more helpful, I cant really excercise the problem as I dont have an arc sde database to test it with. Hopefully we will get some help on the geotools list. > > > *ad 1.)* > java.io.IOException: org.xml.sax.SAXException: Could not find element > handler for http://www.opengis.net/gml : > SALZBURG.SALZBURG.HOLIDAYVOTINGS as a child of FeatureAssociationType. > at org.geotools.xml.gml.FCBuffer.hasNext(FCBuffer.java:304) > at > org.geotools.data.wfs.WFSFeatureReader.loadElement(WFSFeatureReader.java:164) > > at > org.geotools.data.wfs.WFSFeatureReader.hasNext(WFSFeatureReader.java:153) > at > org.geotools.data.wfs.WFSDataStore.getFeatureReader(WFSDataStore.java:763) > at GetFeatureFromWFS.getFeature(GetFeatureFromWFS.java:86) > at > GE_Visualisierung_geOpinion.doGetOrPost(GE_Visualisierung_geOpinion.java:40) > > at > GE_Visualisierung_geOpinion.doGet(GE_Visualisierung_geOpinion.java:116) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) > > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) > > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) > > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) > > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) > > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) > > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) > at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) > > at > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) > > at > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) > > at > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) > > at java.lang.Thread.run(Unknown Source) > Caused by: org.xml.sax.SAXException: Could not find element handler for > http://www.opengis.net/gml : SALZBURG.SALZBURG.HOLIDAYVOTINGS as a child > of FeatureAssociationType. > at org.geotools.xml.XMLSAXHandler.startElement(XMLSAXHandler.java:333) > at > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown > Source) > at > com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown > Source) > at > com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown > Source) > at > com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown > Source) > at > com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown > Source) > at > com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown > Source) > at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown > Source) > at > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown > Source) > at javax.xml.parsers.SAXParser.parse(Unknown Source) > at javax.xml.parsers.SAXParser.parse(Unknown Source) > at > org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:139) > at org.geotools.data.wfs.WFSFeatureReader.run(WFSFeatureReader.java:123) > > *ad 2.)* > java.io.IOException: org.geotools.ows.ServiceException: null > error:Translator error > at org.geotools.xml.gml.FCBuffer.hasNext(FCBuffer.java:304) > at > org.geotools.data.wfs.WFSFeatureReader.loadElement(WFSFeatureReader.java:164) > > at > org.geotools.data.wfs.WFSFeatureReader.hasNext(WFSFeatureReader.java:153) > at > org.geotools.data.wfs.WFSDataStore.getFeatureReader(WFSDataStore.java:763) > at GetFeatureFromWFS.getFeature(GetFeatureFromWFS.java:86) > at > GE_Visualisierung_geOpinion.doGetOrPost(GE_Visualisierung_geOpinion.java:40) > > at > GE_Visualisierung_geOpinion.doGet(GE_Visualisierung_geOpinion.java:116) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) > > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) > > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) > > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) > > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) > > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) > > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) > at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) > > at > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) > > at > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) > > at > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) > > at java.lang.Thread.run(Unknown Source) > Caused by: org.geotools.ows.ServiceException: null error:Translator error > at org.geotools.xml.XMLSAXHandler.endElement(XMLSAXHandler.java:229) > at > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown > Source) > at > com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown > Source) > at > com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown > Source) > at > com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown > Source) > at > com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown > Source) > at > com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown > Source) > at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown > Source) > at > com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown > Source) > at javax.xml.parsers.SAXParser.parse(Unknown Source) > at javax.xml.parsers.SAXParser.parse(Unknown Source) > at > org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:139) > at org.geotools.data.wfs.WFSFeatureReader.run(WFSFeatureReader.java:123) > > *ad 3.)* > wfsURL = new > URL("http://62.218.44.102:8080/geoserver/wfs?Version=1.0.0&Request=GetCapabilities&service=wfs > <http://62.218.44.102:8080/geoserver/wfs?Version=1.0.0&Request=GetCapabilities&service=wfs>"); > > Map m = new HashMap(); > m.put(WFSDataStoreFactory.URL.key, wfsURL); > m.put(WFSDataStoreFactory.TIMEOUT.key, new Integer(10000)); > WFSDataStoreFactory wfsDSF = new WFSDataStoreFactory(); > DataStore wfs = wfsDSF.createNewDataStore(m); > Query query = new > DefaultQuery("ispace:SALZBURG.SALZBURG.HOLIDAYVOTINGS_WGS84"); > FeatureReader ft = wfs.getFeatureReader(query,Transaction.AUTO_COMMIT); > try { > Object[] points = new Object[size]; > Object[] comments = new Object[size]; > Object[] voteTypes = new Object[size]; > > Object[] attributes = new Object[size]; > ft.next().getAttributes(attributes); > > Object[] attribs = new Object[50]; > ft.next().getAttributes(attribs); > int attributeCount = 0; > while(attributeCount<3) > { > ft = wfs.getFeatureReader(query,Transaction.AUTO_COMMIT); > int p=0; > while(ft.hasNext()) > { if(attributeCount == 0) > { > points[p] = ft.next().getAttribute(0); > } > else if(attributeCount == 1) > { > voteTypes[p] = ft.next().getAttribute(1); > } > else if(attributeCount == 2) > { > comments[p] = ft.next().getAttribute(2); > if(comments[p].equals("")) > comments[p] = " "; > } > p++; > } > > attributeCount++; > } > > > > Thank you very much for your help already in advance, > Bernd. > > Sent from the GeoServer - User > <http://www.nabble.com/GeoServer---User-f1194.html> forum at Nabble.com: > Accessing GeoServer with GeoTools > <http://www.nabble.com/Accessing-GeoServer-with-GeoTools-t725568.html#a1901875> > -- Justin Deoliveira The Open Planning Project http://topp.openplans.org |