Opened 16 years ago

Last modified 14 years ago

#2794 new enhancement

add POST tests to msautotest/wxs where applicable

Reported by: tomkralidis Owned by: nsavard
Priority: normal Milestone: 6.0 release
Component: msautotest Version: svn-trunk (development)
Severity: normal Keywords:
Cc: bartvde@…, assefa, warmerdam, dmorissette

Description

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()

Change History (3)

comment:1 by tomkralidis, 16 years ago

Cc: bartvde@… assefa warmerdam dmorissette added
Owner: changed from bartvde@… to nsavard

comment:2 by nsavard, 16 years ago

Tom: I'll check that and let you know.

comment:3 by dmorissette, 14 years ago

Milestone: 5.6 release6.0 release
Note: See TracTickets for help on using tickets.