For my geoserver installation, WFS GetFeature requests with a XML POST body exceeding a content length of 8kB always fail with a javax.xml.stream.XMLStreamException .
I realized this issue, when trying to send a larger geometry via the viewParams WFS GetFeature parameter. Here’s a sample request:
POST http://localhost:58080/geoserver/damage_potential/ows
<GetFeature xmlns="http://www.opengis.net/wfs" service="WFS"
version="1.1.0" outputFormat="application/json"
viewParams="ws:1;
geom:'some long WKT exceeding 8kB .................................'"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
<Query typeName="p_schaden"/>
</GetFeature>
<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://localhost:58080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd">
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>javax.xml.stream.XMLStreamException: ParseError at [row,col]:[4,7756]
Message: An invalid XML character (Unicode: 0x0) was found in the value of attribute "viewParams" and element is "GetFeature".
ParseError at [row,col]:[4,7756]
Message: An invalid XML character (Unicode: 0x0) was found in the value of attribute "viewParams" and element is "GetFeature".</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
Here’s the essential part of the corresponding log:
022-05-24 15:30:45,447 ERROR [geoserver.ows] -
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,7784]
Message: An invalid XML character (Unicode: 0x0) was found in the value of attribute "viewParams" and element is "GetFeature".
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
at org.geoserver.ows.Dispatcher.readOpPost(Dispatcher.java:1607)
at org.geoserver.ows.Dispatcher.service(Dispatcher.java:517)
at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:248)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)
Trying to track it down myself, the problem happens regardless of the WFS endpoint and the actual POST content, as long as the content exceeds roughly 8kB.
My guess from the response is, that the Input stream somehow gets truncated.
From looking at the code in Dispatcher.java I also tried to configure the XML_LOOKAHEAD parameter, but that did not help it.
When enabling Request logging with a large enough buffer, I can see the request being logged from beginning till the end, so there is no truncation on the network layer.
|