Re: [MapServer-users] Call to StoredQuery successful as GET, but fails as POST request

2023-10-06 Thread Seth G via MapServer-users
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=2.0.0=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=2.0.0=GetFeature_ID=findeStrasseHnr=fehren=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
> 
> 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;>
> http://www.opengis.net/wfs; 
> typeName="ms:addresses" srsName="urn:ogc:def:crs:EPSG::25832" 
> xmlns:ms="http://mapserver.gis.umn.edu/mapserver;>
> fehren
> 12
> 
> 
> 
> however will only return 
> 
> 
> 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=WFSVERSION=2.0.0REQUEST=DescribeFeatureTypeTYPENAME=ms:addressesOUTPUTFORMAT=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">
> 
> 
> 
> Strange enough, it will also log some weired error at DEBUG 5:
> 
> [Fri Oct  6 14:59:29 2023].546904 msWFSParseRequest(): WFS post request: 
> 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;> id="findeStrasseHnr" xmlns="http://www.opengis.net/wfs; 
> typeName="ms:addresses" srsName="EPSG::25832"> name="strassenname">fehren name="hausnummer">12
> [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
> 
> 
> 
> https://www.w3.org/2001/XMLSchema;
> xmlns:gml="https://www.opengis.net/gml/3.2;
> id="search_street_nr">
> 
> Straßen- und Hausnummernsuche
> Suche nach einem Straßenname und einer Hausnummer im 
> Adress-WFS
> 
> 
> 
> 
>  
> language="urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression"
> 
> xmlns:ms="https://geoportal.freiburg.de/wfs/gdm_address/gdm_address_gaz;
> returnFeatureTypes="ms:addresses">
>  xmlns:ogc="https://www.opengis.net/ogc;
> typeNames="ms:addresses">
> 
> 
> 
> 
> 
>  singleChar="?" escape="\">
> ms:strassenname
> *${strassenname}*
> 
> 
>  singleChar="?" escape="\">
> ms:hausnummer
> 

[MapServer-users] Call to StoredQuery successful as GET, but fails as POST request

2023-10-06 Thread Froehlich, Dominik via MapServer-users
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=2.0.0=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=2.0.0=GetFeature_ID=findeStrasseHnr=fehren=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

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;>
http://www.opengis.net/wfs; 
typeName="ms:addresses" srsName="urn:ogc:def:crs:EPSG::25832" 
xmlns:ms="http://mapserver.gis.umn.edu/mapserver;>
fehren
12



however will only return


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=WFSVERSION=2.0.0REQUEST=DescribeFeatureTypeTYPENAME=ms:addressesOUTPUTFORMAT=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">



Strange enough, it will also log some weired error at DEBUG 5:

[Fri Oct  6 14:59:29 2023].546904 msWFSParseRequest(): WFS post request: 
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;>http://www.opengis.net/wfs; typeName="ms:addresses" 
srsName="EPSG::25832">fehren12
[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



https://www.w3.org/2001/XMLSchema;
xmlns:gml="https://www.opengis.net/gml/3.2;
id="search_street_nr">

Straßen- und Hausnummernsuche
Suche nach einem Straßenname und einer Hausnummer im 
Adress-WFS




https://geoportal.freiburg.de/wfs/gdm_address/gdm_address_gaz;
returnFeatureTypes="ms:addresses">
https://www.opengis.net/ogc;
typeNames="ms:addresses">






ms:strassenname
*${strassenname}*



ms:hausnummer
${hausnummer}




ms:hausnummernzusatz









ms:hausnummer
ASC









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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users