Try adding SERVICE=WFS to the URL of your POST request. MapServer needs at least something in the URL itself to be able to tell that it's a WFS request, otherwise it assumes by default that it is a traditional mapserv CGI request, hence the "no template provided" error.

I am realizing just now that it may not be correct according to the WFS spec to require that WFS clients include the SERVICE=WFS GET parameter in the case of POST requests. If that's the case then perhaps you could file a ticket to have this fixed in future releases of Mapserver. The simple fix would be for MapServer to automatically include the SERVICE=WFS in the onlineresource advertized in GetCapabilities and hten clients would pick it up automatically.

Daniel

Frank Steggink wrote:
Hello List,

While developing a WFS client, I've encountered a problem with MapServer. I 
don't have a local setup of MapServer running, but use a few public available 
services at the web. Those are:
*       
http://map.ns.ec.gc.ca/MapServer/mapserv.exe?map=/mapserver/services/envdat/config.map
 (MapServer 4.8.3)
*       http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp (MapServer 4.8.1)

Our WFS client supports both GET and POST requests. It checks the Capabilities document which 
HTTP method to use. The document of the first service can be found here: 
http://map.ns.ec.gc.ca/MapServer/mapserv.exe?map=/mapserver/services/envdat/config.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities&;.
 GetCapabilities is always done with GET, but other requests can vary. For testing purposes I 
made POST the default HTTP method for the requests. When I try to do a DescribeFeatureType or a 
GetFeature to these services with POST, I'm getting the following message:

<HTML>
<HEAD><TITLE>MapServer Message</TITLE></HEAD>
<!-- MapServer version 4.8.3 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP 
OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER 
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER 
SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL 
INPUT=SHAPEFILE DEBUG=MSDEBUG -->
<BODY BGCOLOR="#FFFFFF">
mapserv(): Web application error. No template provided. <br>
</BODY></HTML>

The Capabilites document lists the online resource URL's for 
DescribeFeatureType and GetFeature, so POST should be allowed for these WFS 
requests. I'm sure that the WFS request is correct, since it works with other 
WFS servers, like Geoserver, and Oracle Spatial Web Services, and I can not 
find anything that might be wrong on my side. Here is the raw request (headers 
+ post data):

POST /envdat/map.aspx HTTP/1.1
Content-Type: text/xml
Host: map.ns.ec.gc.ca
Content-Length: 579
Expect: 100-continue
Proxy-Connection: Close

<?xml version="1.0" encoding="iso-8859-1"?>
<DescribeFeatureType version="1.0.0" service="WFS" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd"; 
xmlns="http://www.opengis.net/wfs"; xmlns:b="http://www.bentley.com/schemas/x-Bentley.XMLTemplate.0.1"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:ows="http://www.opengis.net/ows"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:ogc="http://www.opengis.net/ogc"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
  <TypeName>wfs:envirodat</TypeName>
</DescribeFeatureType>

While searching the mailing list, I found replies of people suggesting that WFS might not be enabled (MapServer not 
compiled with WFS support), but since WFS requests with GET work fine, this is obviously not the case. I also found 
another suggestion here: 
http://lists.umn.edu/cgi-bin/wa?S2=MAPSERVER-USERS&q=wfs+post+template&s=&f=&a=&b=. It is suggested 
to add the parameters "service=WFS" and "version=1.0.0" to the URL for POST, but this doesn't work 
either. Maybe I would need to test with a more recent build, but I couldn't find one at the web. But this would mean 
that I have to change the online resource URL, but the correct URL cannot be predicted. The correct URL to post to 
should be mentioned in the Capabilities document. The second service (www.bsc-eoc.org) returned the same reply with the 
parameters, but the first service (at map.ns.ec.gc.ca) returned this:

<ServiceExceptionReport
xmlns="http://www.opengis.net/ogc"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://www.opengis.net/ogc 
http://schemas.opengis.net/wms/1.1.1/OGC-exception.xsd";>
  <ServiceException>
msWFSDispatch(): WFS server error. Incomplete WFS request: REQUEST parameter 
missing
  </ServiceException>
</ServiceExceptionReport>

If I would add the Request parameter, then it would be WFS / GET again, and 
that's not what I want. (Well, I normally do, but this is for testing purposes.)
I was getting similar responses with GetFeature, but since I changed my code, the WFS client doesn't come that far (because DescribeFeatureType doesn't work) anymore.
Since there are no problems with GET requests, our client can successfully 
query data. But since POST is also available, I would expect it to work as 
well. I hope that someone can look into this. If POST really causes problems, 
it would be better to remove the associated online resource URL's from the 
Capabilities document.

Regards,

Frank Steggink
Bentley Systems, Inc.
Software Developer Geospatial
3645, boul. Ste-Anne
Québec, Qc. G1E 3L1
Canada
Tel: +1 418 666 7691 ext. 289
E-mail: [EMAIL PROTECTED]
WWW: http://www.bentley.com


--
Daniel Morissette
http://www.mapgears.com/

Reply via email to