ASP wrapper and HTTP GET requests

Kralidis,Tom [Burlington] Tom.Kralidis at EC.GC.CA
Wed Feb 23 11:14:52 EST 2005


> -----Original Message-----
> From: Ed McNierney [mailto:ed at topozone.com] 
> Sent: Wednesday, 23 February, 2005 11:04
> To: Kralidis,Tom [Burlington]; MAPSERVER-DEV at LISTS.UMN.EDU
> Subject: RE: [UMN_MAPSERVER-DEV] ASP wrapper and HTTP GET requests
> 
> 
> Tom -
> 
> I would say this isn't a bug in that script - you're trying 
> to do something the script isn't designed to do.
> 
> ASP parses both the querystring parameters and form variables 
> into two separate collections, each of which can be accessed 
> individually (just as one normally accesses individual CGI 
> parameters).  For example, if a parameter named "map" is 
> passed EITHER on the querystring OR as a form parameter, the 
> statement:
> 
>       foo = Request ("map")
> 
> Will assign the value of that parameter to the variable 
> "foo".  The statement Request.Form("map") will refer 
> specifically to the POST varaible.
> 
> In addition, ASP makes the contents of the original URL 
> querystring available by referring to the entire QueryString 
> collection as Request.QueryString.  The equivalent unparsed 
> string for form variables is Request.Form, as you seem to 
> have already discovered.
> 
> Using Request.QueryString for a GET and Request.Form for a 
> POST should do what you expect.  Your code below does that in 
> the CASE statement, but then has an extra assignment to 
> strRequest that you obviously don't want.
> 
> There may be some confusion because ASP also provides access 
> to all HTTP header information through objects in the 
> Request.ServerVariables collection, like cookies, user agent 
> ID, authentication tokens, etc., and the QUERY_STRING is also 
> accessible as one of those variables.
> 
> Your question about the ServerXMLHTTP call isn't terribly 
> clear - your code is making a GET request to the target WMS 
> server, so I don't quite understand your "will this work for 
> POST" question.  You're not making a POST request - if you 
> want to, you need to set up the parameters appropriately.
> 
> While I encourage new learning opportunities, I would also 
> encourage you to try to find someone with a little more ASP 
> expertise.  These are very basic questions/issues you're 
> running into, and if you intend to use this code in any sort 
> of production environment it would be a good idea to have 
> someone on hand with a little stronger familiarity with what 
> you're doing.
> 

Thanks for the info.  The code posted below is as a result of email
replies just to me so I've posted below.

You are correct, an ASP guru is what is needed here.  Can anyone apply
the correct changes to the code?  At any rate, note that the code below
works.

..Tom

>       - Ed
> 
> Ed McNierney
> President and Chief Mapmaker
> TopoZone.com / Maps a la carte, Inc.
> 73 Princeton Street, Suite 305
> North Chelmsford, MA  01863
> ed at topozone.com
> (978) 251-4242 
> 
> 
> -----Original Message-----
> From: UMN MapServer Developers List 
> [mailto:MAPSERVER-DEV at LISTS.UMN.EDU]
> On Behalf Of Kralidis,Tom [Burlington]
> Sent: Tuesday, February 22, 2005 10:13 PM
> To: MAPSERVER-DEV at LISTS.UMN.EDU
> 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\WM
> S\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