Hi,

About WFS-T I have no knowledge, because I use MapServer, which doesn't
support that.

Arnd

-----Ursprüngliche Nachricht-----
Von: Samuel Smith [mailto:[email protected]] 
Gesendet: Donnerstag, 9. Dezember 2010 22:29
An: Arnd Wippermann; [email protected]
Betreff: RE: [OpenLayers-Users] MSXML2.ServerXMLHTTP - POST not
GET-OpenLayers/Mapserver WFS

Hey Arnd,

This sounds like very good news. Can you please let me know what service
context you were using the requests in? (Ie where you able to update/insert
features to a WFS-T using this approach?).

Pure .ASP, too! Keep it real brother.

SFS



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Arnd
Wippermann
Sent: December-10-10 10:24 AM
To: [email protected]
Subject: AW: [OpenLayers-Users] MSXML2.ServerXMLHTTP - POST not
GET-OpenLayers/Mapserver WFS

I have found a solution in the internet to get asp post working with
OpenLayers.

Instead of Request.Form to get the post data, one have to use
Request.BinaryRead.
Source : http://www.bigresource.com/Tracker/Track-asp-zMoQgx8B/

Below the code snippet, that works for me:

Dim requestMethod, strParams, strRequest, strURL, lngByteSize

requestMethod = Request.ServerVariables("REQUEST_METHOD")

strParams   = Request.QueryString

lngByteSize = Request.TotalBytes
strRequest  = BytesToText(Request.BinaryRead(lngByteSize))

'not working
'strRequest  = Request.Form

strURL      = MapserverUrl & strParams

Dim objHTTP

set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.open "POST", strURL, false
objHTTP.setRequestHeader "Content-Type", "application/xml; charset=UTF-8"
'"application/x-www-form-urlencoded"
objHTTP.send strRequest
Response.write objHTTP.responseText
set objHTTP = nothing


'Quelle : http://www.bigresource.com/Tracker/Track-asp-zMoQgx8B/
Function BytesToText(strBytes)

  Dim lngLength, lngIndex, lngAsciiCode

  strAsciiText = ""

  lngLength = LenB(strBytes)
  For lngIndex = 1 To lngLength
    lngAsciiCode = AscB(MidB(strBytes, lngIndex, 1))
    strAsciiText = strAsciiText & Chr(lngAsciiCode)
  Next

  BytesToText = strAsciiText

End Function


Here is the application, where I use this approach:
http://gis.ibbeck.de/ginfo/apps/Landtagswahl_NRW_2010/Wahlen_NRW_2010.asp


Arnd


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Arnd
Wippermann
Gesendet: Donnerstag, 9. Dezember 2010 19:20
An: 'Donald Kerr'
Cc: [email protected]
Betreff: AW: [OpenLayers-Users] MSXML2.ServerXMLHTTP - POST not
GET-OpenLayers/Mapserver WFS

Hi,

I want also use an asp-script to hide the mapfile and have the same problem
to get working the OpenLayers.Control.GetFeature.

I'm not able to catch the request of the control with asp. Request.Form
contains nothing and results in the mentioned MapServer message

... WCS Server does not support XML POST requests ...

If I try a script with OpenLayers.Request.issue for testing with the same
post parameter, then the asp-script get the post parameter and sending this
to MapServer and retrieving the response works as expected.

Is there something specific with the OpenLayers.Protocol.WFS, so that the
asp-script get the post parameter?

Arnd




-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Donald Kerr
Gesendet: Donnerstag, 9. Dezember 2010 00:14
An: [email protected]; [email protected]
Betreff: [OpenLayers-Users] MSXML2.ServerXMLHTTP - POST not GET
-OpenLayers/Mapserver WFS

Apologies for cross-posting on two lists but I'm not sure who may be better
placed to answer this one.

Basically, the setup is MapServer and OpenLayers. I have two pages, both are
exactly the same with the exception that one calls mapserver on Port 81
(Apache) and the other calls Mapserver on Port 81 via an asp page using
MSXML2.ServerXMLHTTP to hide the mapfile string and its location. This
method is documented here: http://mapserver.org/ogc/wms_server.html (3.On
IIS servers (Windows), you can use the following ASP script ..... etc).

OpenLayers.Layer.WFS works fine on both setups as this uses GET requests but
this will be deprecated in version 3, see here:
http://dev.openlayers.org/docs/files/OpenLayers/Layer/WFS-js.html.

I am trying to port the setup so that it uses OpenLayers.Layer.Vector with
OpenLayers.Protocol.WFS which uses POST as opposed to GET. This works fine
with the setup that calls Apache directly on port 81 but does not work using
MSXML2.ServerXMLHTTP in the asp page. When I say that it works fine with
Apache, it returns valid GML but there's no geometry which, I believe, is
sorted in MapServer 5.6.4 - I am using 5.6.3 in the latest MS4W package.

The method using MSXML2.ServerXMLHTTP (see the first link above) converts
everything to GET but I have changed the code to use post as follows:

=============================================================
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")

Select Case Request.ServerVariables("REQUEST_METHOD")
        Case "GET"
                strRequest = Request.QueryString
                MapserverUrl = "<url>mapserv.exe?MAP=<map file>.map&" &
strRequest
                xmlhttp.open "GET", MapServerURL, False
                xmlhttp.send '
        Case "POST"
                strRequest = Request.Form
                MapserverUrl = "<url>mapserv.exe?MAP=<map file>"
                xmlhttp.Open "POST", MapserverUrl, False

                Set SendDoc = server.createobject("Microsoft.XMLDOM")
                SendDoc.ValidateOnParse= True
                SendDoc.LoadXML(strRequest)

                'Various header types (All tried at different times)
                'xmlhttp.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"
                'xmlhttp.setRequestHeader "Content-Type", "application/xml"
//OpenLayers
                'xmlhttp.setRequestHeader "Content-Type","text/xml"

                'Two ways of sending xml (Both tried)
                'xmlhttp.send strRequest
                xmlhttp.send Sendoc
End Select

Response.ContentType = xmlhttp.getResponseHeader("content-type")
Response.BinaryWrite xmlhttp.responseBody

Set xmlhttp = Nothing
=============================================================

I have tried everything I can think of including setting a variable that
contains the xml within the code above, i.e. it isn't sent from the html
page with the map, to no avail.

The closest I can get to it working is a response (as shown in Firebug) as
follows:

=============================================================
<?xml version='1.0' encoding="ISO-8859-1" ?> <ServiceExceptionReport
version="1.2.0" 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/wfs/1.0.0/OGC-exception.xsd";>
  <ServiceException code="InvalidParameterValue" locator="filter">
msWFSGetFeature(): WFS server error. Invalid or Unsupported FILTER in
GetFeature : &lt;filter ogc=&quot;http://www.opengis.net/ogc&quot;&gt;
  &lt;bbox&gt;
    &lt;propertyname&gt;msGeometry&lt;/propertyname&gt;
    &lt;box gml=&quot;http://www.opengis.net/gml&quot;
srsName=&quot;EPSG:27700&quot;&gt;
      &lt;coordinates decimal=&quot;.&quot; cs=&quot;,&quot; ts=&quot;
&quot;&gt;256643.52324254,664529.16740962
260422.47675746,667280.83259038&lt;/coordinates&gt;
    &lt;/box&gt;
  &lt;/bbox&gt;
&lt;/filter&gt;

  </ServiceException>
</ServiceExceptionReport>
=============================================================

The above is using a variable (that contains xml) in the asp file and not
the Request.Form in the code above.

I also get the following when using the Request.Form from the map page:

=============================================================
<?xml version='1.0' encoding="ISO-8859-1" ?> <ServiceExceptionReport
version="1.2.0"
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/wcs/1.0.0/OGC-exception.xsd";>
  <ServiceException>msWCSParseRequest(): WCS server error. WCS Server does
not support XML POST requests, please use KVP.
  </ServiceException>
</ServiceExceptionReport>
=============================================================

What I want to get using MSXML2.ServerXMLHTTP is the same response as I get
using the method that calls MapServer on port 81 i.e. I should get valid GML
without the geometry.

OpenLayers uses MSXML2.ServerXMLHTTP for the POST and all I am really trying
to do is pass that request through another MSXML2.ServerXMLHTTP to
MapServer. This is be quite basic I think but I have spent hours on the
problem and have visited everything that I possibly can on Google without
success. I suppose that someone who knows about MSXML2.ServerXMLHTTP might
be the person to ask but I am hopeful that someone in the MapServer or the
OpenLayers community might have cracked this problem.

I'm stumped! HELP PLEASE!!!

Many thanks.

Regards,

Donald Kerr

P.S. Please don't tell me to use Apache directly! I know that this may be a
solution that would work but I want to solve this one and I want to have IIS
on port 80 for other stuff and MS4w on Port 81 for maps.

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to