Greetings,
I am using GeoTools 2.5.5 to try retrieve features from a WFS. I get this
exception when using a Filter either by itself or with a Query (see full
exception at bottom).
Jun 12, 2009 11:57:21 AM org.geotools.xml.XMLSAXHandler processException
SEVERE: POST
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
...
I have tried filtering by bounding box and by feature properties. Here is
the query code.
SimpleFeatureType schema = dataStore.getSchema(typeName);
String geometryPropertyName = schema.getGeometryDescriptor()
getLocalName();
CoordinateReferenceSystem crs = schema.getGeometryDescriptor()
.getCoordinateReferenceSystem();
FeatureSource<SimpleFeatureType, SimpleFeature> featureSource =
dataStore
.getFeatureSource(typeName);
FilterFactory2 filterFactory = CommonFactoryFinder
.getFilterFactory2(GeoTools.getDefaultHints());
ReferencedEnvelope bbox = new ReferencedEnvelope(-59.5, 46.5,
-52.5, -52.0, crs);
Filter filter = filterFactory.bbox(filterFactory
.property(geometryPropertyName), bbox);
Query query = new DefaultQuery(typeName, filter);
features = featureSource.getFeatures(query);
...
Filter newfoundlandFilter = filterFactory.equals(filterFactory
.property("wfs:PRV_NAME"), filterFactory
.literal("NEWFOUNDLAND"));
Filter canadaFilter = filterFactory.equals(filterFactory
.property("wfs:CNTY_CODE"), filterFactory.literal("CA"));
filter = filterFactory.and(newfoundlandFilter, canadaFilter);
Query query = new DefaultQuery(typeName, filter);
features = featureSource.getFeatures(query);
I used WireShark to see what was being send to the WFS. I noticed that there
were duplicate <ogc:Filter></ogc:Filter> element in the XML (see below). I
believe that this extra element is what causes the exception.
<?xml version="1.0" encoding="UTF-8"?>
<GetFeature xmlns="http://www.opengis.net/wfs"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0" service="WFS"
outputFormat="GML2"><Query
typeName="wfs:N10M_BND_POLY"><ogc:Filter><ogc:BBOX><ogc:PropertyName>GEOM</ogc:PropertyName>
<gml:Box><gml:coordinates decimal="." cs="," ts=" ">-59.5,-52.5
46.5,52.0</gml:coordinates>
</gml:Box>
</ogc:BBOX>
<ogc:Filter></ogc:Filter>
</ogc:Filter>
</Query>
</GetFeature>
<?xml version="1.0" encoding="UTF-8"?>
<GetFeature xmlns="http://www.opengis.net/wfs"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0" service="WFS"
outputFormat="GML2"><Query
typeName="wfs:N10M_BND_POLY"><ogc:Filter><ogc:And><ogc:PropertyIsEqualTo><ogc:PropertyName>wfs:PRV_NAME</ogc:PropertyName>
<ogc:Literal>NEWFOUNDLAND</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo><ogc:PropertyName>wfs:CNTY_CODE</ogc:PropertyName>
<ogc:Literal>CA</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
<ogc:Filter></ogc:Filter>
</ogc:Filter>
</Query>
</GetFeature>
Is this a (known) bug?
Have I set up the filter incorrectly?
Any help would be appreciated.
Cheers,
John
Jun 12, 2009 12:21:49 PM org.geotools.xml.XMLSAXHandler processException
SEVERE: POST
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
at com.ionicsoft.wfs.ErrorUtil.createError(Unknown Source)
at com.ionicsoft.wfs.ErrorUtil.throwError(Unknown Source)
at com.ionicsoft.wfs.ErrorUtil.throwError(Unknown Source)
at
com.ionicsoft.wfs.sql.XMLFilterBuilder$FilterOperator.translateNode(Unknown
Source)
at com.ionicsoft.wfs.sql.XMLFilterBuilder.if(Unknown Source)
at com.ionicsoft.wfs.sql.XMLFilterBuilder.translateOneNode(Unknown
Source)
at
com.ionicsoft.wfs.sql.BaseXMLFilterBuilder.translateFilterPart(Unknown
Source)
at com.ionicsoft.wfs.sql.QueryInstantier.construct(Unknown Source)
at com.ionicsoft.wfs.server.FeatureGenerator.serialize(Unknown Source)
at com.ionicsoft.wfs.server.XMLGetFeatureProcessor.process(Unknown
Source)
at com.ionicsoft.wfs.server.IXMLProcessor.basicProcessing(Unknown
Source)
at com.ionicsoft.wfs.server.IXMLProcessor.processSoapMessage(Unknown
Source)
at com.ionicsoft.servlet.SoapProcessorImpl.processSoapMessage(Unknown
Source)
at com.ionicsoft.servlet.SoapProcessorImpl.computeResponse(Unknown
Source)
at com.ionicsoft.servlet.MethodServlet.doGetPost(Unknown Source)
at com.ionicsoft.servlet.MethodServlet.doPost(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at com.ionicsoft.servlet.BaseServlet.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at
com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
at
com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
org.geotools.xml.filter.FilterComplexTypes$ServiceExceptionType.getValue(FilterComplexTypes.java:1669)
org.geotools.xml.handlers.ComplexElementHandler.endElement(ComplexElementHandler.java:157)
org.geotools.xml.XMLSAXHandler.endElement(XMLSAXHandler.java:266)
org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
javax.xml.parsers.SAXParser.parse(SAXParser.java:176)
org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:140)
org.geotools.data.wfs.v1_0_0.WFSFeatureReader.run(WFSFeatureReader.java:125)
Jun 12, 2009 12:21:49 PM org.geotools.xml.XMLSAXHandler endElement
WARNING: POST
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
...
Jun 12, 2009 12:21:49 PM org.geotools.xml.XMLSAXHandler endElement
WARNING: Line 33 Col 20
Jun 12, 2009 12:21:49 PM org.geotools.data.wfs.v1_0_0.NonStrictWFSStrategy
createFeatureReaderPOST
WARNING: java.io.IOException: org.geotools.ows.ServiceException: POST
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
...
Jun 12, 2009 12:21:50 PM org.geotools.xml.XMLSAXHandler processException
SEVERE: GetFeature
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
...
Jun 12, 2009 12:21:50 PM org.geotools.xml.XMLSAXHandler endElement
WARNING: GetFeature
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
Jun 12, 2009 12:21:50 PM org.geotools.xml.XMLSAXHandler endElement
WARNING: Line 35 Col 20
java.util.NoSuchElementException: Could not aquire
feature:java.io.IOException: org.geotools.ows.ServiceException: GetFeature
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
com.ionicsoft.api.wfs.WFSLanguageException:
(Error.FilterOneOperatorAllowed)The filter can contain only one operator.
--
View this message in context:
http://n2.nabble.com/Exception-when-using-Filter-during-getFeatures%28query%29.-Duplicate-filter-elements.-tp3069521p3069521.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users