ASP wrapper and HTTP GET requests

Brent Fraser bfraser at GEOANALYTIC.COM
Wed Feb 23 10:43:47 EST 2005


Tom,

  Your code is pretty close.  I made one minor change by commenting-out the
second strRequest assignment:

<%
    Server.ScriptTimeout = 360

    Select Case Request.ServerVariables("REQUEST_METHOD")
      Case "GET"  strRequest = Request.QueryString
      Case "POST" strRequest = Request.Form
    End Select

'   Remove the following line:
'    strRequest = Request.ServerVariables("QUERY_STRING")

    strURL =
"http://myserver/cgi-bin/mapserv.exe?map=C:\Inetpub\wwwroot\workshop\itasca.
map&" & strRequest

    Dim objHTTP
    Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
    '
    ' will this line below work for POST requests? YES!
    '
    objHTTP.open "GET", strURL, false

    objHTTP.send ""
    Response.ContentType = objHTTP.getResponseHeader("content-type")
    Response.BinaryWrite objHTTP.responseBody
    Set objHTTP = Nothing


%>

This works with the Itasca demo in workshop.zip (with index.html using "GET"
or "POST" ); I haven't tested it with WMS yet.

Brent Fraser

----- Original Message -----
From: "Kralidis,Tom [Burlington]" <Tom.Kralidis at EC.GC.CA>
To: <MAPSERVER-DEV at LISTS.UMN.EDU>
Sent: Tuesday, February 22, 2005 8:12 PM
Subject: Re: [UMN_MAPSERVER-DEV] ASP wrapper and HTTP GET requests


Thanks for the info.

Bug 1253 does not have a template problem.  What's happening is that the
POST request is sent to ASP script, which passes as a GET request with
no arguments.

Can someone try this out and verify this works?  Also see comment line
below in the code:

  <%
    Server.ScriptTimeout = 360
    Select Case Request.ServerVariables("REQUEST_METHOD")
      Case "GET" strRequest = Request.QueryString
      Case "POST" strRequest = Request.Form
    End Select
    strRequest = Request.ServerVariables("QUERY_STRING")
    strURL =
"http://myserver/cgi-bin/mapserv.exe?map=C:\Inetpub\wwwroot\WMS\mymap.ma
p&" & strRequest
    Dim objHTTP
    Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
    '
    ' will this line below work for POST requests?
    '
    objHTTP.open "GET", strURL, false

    objHTTP.send ""
    Response.ContentType = objHTTP.getResponseHeader("content-type")
    Response.BinaryWrite objHTTP.responseBody
    Set objHTTP = Nothing
  %>

..Tom



> -----Original Message-----
> From: UMN MapServer Developers List
> [mailto:MAPSERVER-DEV at LISTS.UMN.EDU] On Behalf Of Jerry Pisk
> Sent: Tuesday, 22 February, 2005 20:46
> To: MAPSERVER-DEV at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-DEV] ASP wrapper and HTTP GET requests
>
>
> You can easily change that sample ASP page to support POST
> requests, replace the query string read with this:
>
> Select Case Request.ServerVariables("REQUEST_METHOD")
>   Case "GET" strRequest = Request.QueryString
>   Case "POST" strRequest = Request.Form
>   Case Else ' Handle other methods here
> End Select
>
> The problem in bug 1253 is not related to this though, it's
> caused by a missing template in a mapfile as far as I can tell.
>
> Jerry Pisk
>
> On Tue, 22 Feb 2005 18:27:57 -0500, Kralidis,Tom [Burlington]
> <Tom.Kralidis at ec.gc.ca> wrote:
> > Hi,
> >
> > There seems to be a problem with the ASP wrapper example
> provided for
> > hiding the mapfile from:
> >
> >
> http://mapserver.gis.umn.edu/doc44/wms-server-howto.html#onlineresourc
> > eu
> > rl
> >
> > I've filed a bug against this:
> >
> > http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1253
> >
> > The wrapper script doesn't support POST requests.
> >
> > Are there any ASP gurus out there who can tweak the example
> so that it
> > can recognize when a POST request comes in and pass it as such?
> >
> > Thanks
> >
> > ..Tom
> >
>



More information about the mapserver-dev mailing list