[mapserver-users] MapServer 7.0 WFS post request using ogc filter

Even Rouault even.rouault at spatialys.com
Thu Aug 18 02:31:58 PDT 2016


Le mercredi 17 août 2016 19:31:40, TMa Teng a écrit :
> Yes, I am able to use GET method to get the features when use the WFS.
> 
> Get request example:
> http://gisappsdev:8080/cgi-bin/mapserv.exe?map=/ms4w/apps/SanbornImage/Sanb
> ornImage_wfs.map&REQUEST=GetFeature&SERVICE=WFS&VERSION=1.0.0&TYPENAME=Sanb
> ornGeoref&MAXFEATURES=20&bbox=-72.93411254882812,41.30730211327143,-72.9309
> 9045753479,41.30866411858396
> 
> It returns features as expected.
> 
> The problem is when I try to get features using POST method on the same WFS
> (see raw in fiddler below):
> 
> POST
> http://gisappsdev:8080/cgi-bin/mapserv.exe?map=/ms4w/apps/SanbornImage/San
> bornImage_wfs.map HTTP/1.1 Content-Type: multipart/form-data;
> User-Agent: Fiddler
> Content-Length: 814
> Host: gisappsdev:8080

I've tried the following with a mapfile from MapServer test suite :

cat request.xml | CONTENT_TYPE=text/xml MS_MAPFILE=wfs_200.map REQUEST_METHOD=POST mapserv

where request.xml is as close as possible to yours :

<?xml version="1.0" encoding="ISO-8859-1"?>
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" 
maxFeatures="100" xsi:schemaLocation="http://www.opengis.net/wfshttp://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <wfs:Query typeName="province" xmlns:feature="http://gisappsdev:8080/cgi-bin/mapserv.exe" srsName="EPSG:4326">
    <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
       <ogc:BBOX>
        <ogc:PropertyName>shape</ogc:PropertyName>
        <gml:Envelope xmlns:gml="http://www.opengis.net/gml">
          <gml:lowerCorner>-81 41</gml:lowerCorner>
          <gml:upperCorner>-80.9 41.01</gml:upperCorner>
        </gml:Envelope>
      </ogc:BBOX>
    </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

And it returns:

Content-Type: text/xml; subtype=gml/3.1.1; charset=UTF-8

<?xml version='1.0' encoding="UTF-8" ?>
<wfs:FeatureCollection
   xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
   xmlns:gml="http://www.opengis.net/gml"
   xmlns:wfs="http://www.opengis.net/wfs"
   xmlns:ogc="http://www.opengis.net/ogc"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver 
http://localhost/path/to/wfs_simple?myparam=something&SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=province&OUTPUTFORMAT=text/xml;
%20subtype=gml/3.1.1  http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
   <gml:boundedBy>
      <gml:Null>missing</gml:Null>
   </gml:boundedBy>
</wfs:FeatureCollection>

So it behaves as expected.

Looking at the above header, this might perhaps come from "Content-Type: multipart/form-data;" The terminating semi-column is a bit suspicous. Also
this is incorrect in that instance and should be "text/xml".
Another possibilitiy, more likely, is that the Content-Length is wrong. If I paste your below XML with DOS end-of-line (CR-LF), I get 813 bytes (or 815 if I add an extra return line), not 814.
So MapServer could try to read one extra byte that never comes, hence the timeout.

> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
> version="1.1.0" maxFeatures="100"
> 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"> <wfs:Query
> typeName="SanbornGeoref"
> xmlns:feature="http://gisappsdev:8080/cgi-bin/mapserv.exe"
> srsName="EPSG:4326"> <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
>        <ogc:BBOX>
>         <ogc:PropertyName>shape</ogc:PropertyName>
>         <gml:Envelope xmlns:gml="http://www.opengis.net/gml">
>           <gml:lowerCorner>-81 41</gml:lowerCorner>
>           <gml:upperCorner>-80.9 41.01</gml:upperCorner>
>         </gml:Envelope>
>       </ogc:BBOX>
>     </ogc:Filter>
>   </wfs:Query>
> </wfs:GetFeature>

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the mapserver-users mailing list