[MapServer-users] Call to StoredQuery successful as GET, but fails as POST request
Seth G
sethg at geographika.co.uk
Fri Oct 6 13:57:10 PDT 2023
Hi,
Are you able to log the SQL sent to Postgres and see the difference between the GET and POST request? Or maybe the query doesn't get to the database at all looking at that error.
It looks like the filter is failing to convert to a Postgres query.
Seth
--
web:https://geographika.net & https://mapserverstudio.net
twitter: @geographika
On Fri, Oct 6, 2023, at 4:45 PM, Froehlich, Dominik via MapServer-users wrote:
> Dear *
>
>
> I'm stuck for some time experiencing a strange behavoiur with WFS POST requests to stored querys on our mapserver (v.8.0.1/ubuntu 22.04) and can't seem to find anythin helpful in the logs or on the web. The server is public, so you can see for yourselves. To describe the issue I'll stick to our address service providing the addresses in Freiburg im Breisgau, Southwest Germany.
>
> https://geoportal.freiburg.de/wfs/gdm_address/gdm_address?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetCapabilities
>
> The service is supposed to answer both GET and POST requests. This does work just fine for "normal" GetFeature requests. However, there seems to be an issue with stored queries. E.g. we set up some stored query for searching addresses taking a street name and a house number as an argument. It can be easily queried by calling e.g.
>
> https://geoportal.freiburg.de/wfs/gdm_address/gdm_address?SERVICE=WFS&version=2.0.0&REQUEST=GetFeature&StoredQuery_ID=findeStrasseHnr&strassenname=fehren&hausnummer=12
>
> wheras "strassenname" is the street name and "hausnummer" the house number.
> The GET call will return one matching feature as expected.
>
>
> The same request as POST to https://geoportal.freiburg.de/wfs/gdm_address/gdm_address
>
> <GetFeature xmlns="http://www.opengis.net/wfs" service="WFS" version="2.0.0" maxFeatures="3" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <StoredQuery id="findeStrasseHnr" xmlns="http://www.opengis.net/wfs" typeName="ms:addresses" srsName="urn:ogc:def:crs:EPSG::25832" xmlns:ms="http://mapserver.gis.umn.edu/mapserver">
> <Parameter name="strassenname">fehren</Parameter>
> <Parameter name="hausnummer">12</Parameter>
> </StoredQuery>
> </GetFeature>
>
> however will only return
>
> <?xml version='1.0' encoding="UTF-8" ?>
> <wfs:FeatureCollection
> xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
> xmlns:gml="http://www.opengis.net/gml/3.2"
> xmlns:wfs="http://www.opengis.net/wfs/2.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver https://geoportal.freiburg.de/wfs/gdm_address/gdm_address?SERVICE=WFS&VERSION=2.0.0&REQUEST=DescribeFeatureType&TYPENAME=ms:addresses&OUTPUTFORMAT=application%2Fgml%2Bxml%3B%20version%3D3.2 http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd"
> timeStamp="2023-10-05T16:10:00" numberMatched="unknown" numberReturned="0">
> </wfs:FeatureCollection>
>
>
> Strange enough, it will also log some weired error at DEBUG 5:
>
> [Fri Oct 6 14:59:29 2023].546904 msWFSParseRequest(): WFS post request: <GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="2.0.0" maxFeatures="200" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsdhttp://www.opengis.net/wfs%20http:/schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><StoredQuery id="findeStrasseHnr" xmlns="http://www.opengis.net/wfs" typeName="ms:addresses" srsName="EPSG::25832"><Parameter name="strassenname">fehren</Parameter><Parameter name="hausnummer">12</Parameter></StoredQuery></GetFeature>
> [Fri Oct 6 14:59:29 2023].622878 FLTLayerApplyPlainFilterToLayer(): (("[strassenname]" ~* "^.*feh.*$") AND (([hausnummer] =* 12) AND ("[hausnummernzusatz]" = ""))), rect=399550,5305350,420740,5325690
> [Fri Oct 6 14:59:29 2023].689509 msPostGISLayerTranslateFilter(): General error message. Translation to native SQL failed.
> [Fri Oct 6 14:59:30 2023].110714 msQueryByFilter(): No matching record(s) found.[Fri Oct 6 14:59:30 2023].110799 mapserv request processing time (msLoadMap not incl.): 0.564s
>
>
> The stored query itself is defined as
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <StoredQueryDescription xmlns:xs="https://www.w3.org/2001/XMLSchema"
> xmlns:gml="https://www.opengis.net/gml/3.2"
> id="search_street_nr">
>
> <Title>Straßen- und Hausnummernsuche</Title>
> <Abstract>Suche nach einem Straßenname und einer Hausnummer im Adress-WFS</Abstract>
>
> <Parameter name="strassenname" type="string"/>
> <Parameter name="hausnummer" type="string"/>
>
> <QueryExpressionText isPrivate="false"
> language="urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression"
> xmlns:ms="https://geoportal.freiburg.de/wfs/gdm_address/gdm_address_gaz"
> returnFeatureTypes="ms:addresses">
> <Query
> xmlns:ogc="https://www.opengis.net/ogc"
> typeNames="ms:addresses">
>
> <ogc:Filter>
>
> <ogc:AND>
>
> <ogc:PropertyIsLike matchCase="false" wildCard="*" singleChar="?" escape="\">
> <ogc:ValueReference>ms:strassenname</ogc:ValueReference>
> <Literal>*${strassenname}*</Literal>
> </ogc:PropertyIsLike>
>
> <ogc:PropertyIsEqualTo matchCase="false" wildCard="*" singleChar="?" escape="\">
> <ogc:ValueReference>ms:hausnummer</ogc:ValueReference>
> <Literal>${hausnummer}</Literal>
> </ogc:PropertyIsEqualTo>
>
> <ogc:PropertyIsEqualTo matchCase="false">
> <ogc:ValueReference>ms:hausnummernzusatz</ogc:ValueReference>
> <Literal></Literal>
> </ogc:PropertyIsEqualTo>
>
> </ogc:AND>
>
> </ogc:Filter>
>
> <ogc:sortBy>
> <ogc:SortProperty>
> <ogc:ValueReference>ms:hausnummer</ogc:ValueReference>
> <ogc:SortOrder>ASC</ogc:SortOrder>
> </ogc:SortProperty>
> </ogc:sortBy>
>
> </Query>
> </QueryExpressionText>
>
> </StoredQueryDescription>
>
>
> Am I missing something here or do you have any suggestions for me? I'm grateful for any insights! Please also let me know if you need more details on something else.
>
> Best,
>
> Dominik
>
>
>
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20231006/47279eda/attachment.htm>
More information about the MapServer-users
mailing list