add POST tests to msautotest/wxs where applicable
Reporter: tomkralidis Date: 2008/10/15 - 05:09 Trac URL: http://trac.osgeo.org/mapserver/ticket/2794 Norm: Bart's testcase in #1287 shows a good example of doing HTTP POST requests from python.
We should investigate the feasibility of if/how to add something like this to msautotest to be able to test OWS HTTP POST functionality.
Here's an example:
#!/usr/bin/python
import httplib, urllib, string, base64, time
#1) set variable for request to be posted
request="""
<GetFeature service="WFS" version="1.0.0"
xmlns="http://www.opengis.net/wfs"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0 WFS-basic.xsd">
<Query typeName="service_resources">
<ogc:Filter>
<ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
<ogc:PropertyName>keywords</ogc:PropertyName>
<ogc:Literal>*birds*</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Filter>
</Query>
</GetFeature>
"""
# set WFS servername and hostname
hostname="devgeo.cciw.ca"
server="/cgi-bin/mapserv/owscat"
# execute the request
h = httplib.HTTP(hostname)
h.putrequest("POST", server)
h.putheader("Content-type", "text/xml")
h.putheader("Content-length", "%d" % len(request))
h.putheader("Accept", "text/xml")
h.putheader('Host', hostname)
h.endheaders()
h.send(request)
reply, msg, hdrs = h.getreply()
# print the response
print h.getfile().read()
Author: nsavard Date: 2008/10/15 - 16:41 Tom: I'll check that and let you know.
By looking at the contents of https://github.com/mapserver/msautotest/tree/master/wxs this ticket is probably still valid.
I see that word DEPRECATED appears here https://github.com/MapServer/msautotest_DEPRECATED/tree/master/wxs. Closing without spending more time for this.