<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
I got a walkaround to address this issue by trying. Here is the solution: instead of using loadparams(), just assign the querystring in the post request to OWSRequest. <br>It worked. :-)<br><br><font style="" face="Courier New"> public void ProcessRequest (HttpContext context) {</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> try</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> {</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> OWSRequest req = new OWSRequest();</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> System.Collections.Specialized.NameValueCollection queryStr = context.Request.QueryString;</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> for (int i = 0; i < queryStr.Count; ++i) req.setParameter(queryStr.GetKey(i), queryStr.Get(i));</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> <br> if (context.Request.HttpMethod == "POST")</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> {</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> StreamReader reader = new StreamReader(context.Request.InputStream, context.Request.ContentEncoding); //System.Text.Encoding.UTF8</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> String sXMLRequest = reader.ReadToEnd();</font><font style="" face="Courier New"><br></font><b><font style="" face="Courier New"> req.type = MS_REQUEST_TYPE.MS_POST_REQUEST;</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> req.postrequest = sXMLRequest;</font></b><font style="" face="Courier New"><br></font><font style="" face="Courier New"> }</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> ...</font><br><br><br><br><br><br><hr id="stopSpelling">Date: Fri, 10 Sep 2010 09:36:04 +0200<br>Subject: Re: [mapserver-users] C# mapscripts and WFS Service , xml-encoded Post Request with openlayers<br>From: szekerest@gmail.com<br>To: wingicelee@hotmail.com<br>CC: mapserver-users@lists.osgeo.org<br><br>Hi,<br><br>Currently loadParams can only be called within the context of a CGI process and it may not be usable ny an <a href="http://ASP.NET" target="_blank">ASP.NET</a> application. However I'll inversigate the approach whether it could be made suitable for use in <a href="http://ASP.NET" target="_blank">ASP.NET</a> environment too.<br>
<br>Best regards,<br><br>Tamas<br><br><br><br><div class="ecxgmail_quote">2010/9/10 Fuming Li <span dir="ltr"><<a href="mailto:wingicelee@hotmail.com">wingicelee@hotmail.com</a>></span><br><blockquote class="ecxgmail_quote" style="padding-left: 1ex;">
<div><div class="ecxim">
Hi, I 'm currently deploying a WFS Server with C# mapscripts. The
Request issued by openlayers is xml-encoded post request.<br>
When I
tried to use "loadparam", it exited abnormally. So I had to parse
parameter by myself. So my question is: do I have to parse the
xml-encoded post request manually?<br>
is there a function I can use to
parse the post request?<br>
<br></div>
WFS Service:<br>
<br>
<font face="Courier New">public class MapWFS : IHttpHandler {</font><font face="Courier New"><br>
</font><font face="Courier New"> </font><font face="Courier New"><br>
</font><font face="Courier New"> public void ProcessRequest
(HttpContext context) {</font><font face="Courier New"><br>
</font><font face="Courier New"> try</font><font face="Courier New"><br>
</font><font face="Courier New"> {</font><font face="Courier New"><br>
</font><font face="Courier New"> OWSRequest req =
new OWSRequest();</font><font face="Courier New"><br>
</font><font face="Courier New"><br>
</font><font face="Courier New">
System.Collections.Specialized.NameValueCollection queryStr =
context.Request.Params;</font><font face="Courier New"><br>
</font><font face="Courier New"><br>
</font><font face="Courier New">
//req.loadParams(); can't call this function, it will exit immediately.</font><font face="Courier New"><br>
</font><font face="Courier New">
req.setParameter("service", "WFS");</font><font face="Courier
New"><br>
</font><font face="Courier New">
req.setParameter("version", "1.0.0");</font><font face="Courier
New"><br>
</font><font face="Courier New">
req.setParameter("request", "getFeature");</font><font face="Courier New"><br>
</font><font face="Courier New"> </font><font face="Courier New"><br>
</font><font face="Courier New"> for (int i = 0; i
< queryStr.Count; ++i)</font><font face="Courier New"><br>
</font><font face="Courier New"> {</font><font face="Courier New"><br>
</font><font face="Courier New">
req.setParameter(queryStr.GetKey(i), queryStr.Get(i));</font><font face="Courier New"><br>
</font><font face="Courier New"> }</font><font face="Courier New"><br>
</font><font face="Courier New"> </font><font face="Courier New"><br>
</font><font face="Courier New"> string mapFileName =
ConfigurationManager.AppSettings["MapFilePath"];</font><font face="Courier New"><br>
</font><font face="Courier New"> mapObj map = new
mapObj(context.Server.MapPath(mapFileName));</font><font face="Courier New"><br>
</font><font face="Courier New"> ...</font><font face="Courier New"><br>
</font><font face="Courier New"> </font><font face="Courier New"><br>
</font><font face="Courier New">
mapscript.msIO_installStdoutToBuffer();</font><font face="Courier New"><br>
</font><font face="Courier New"><br>
</font><font face="Courier New">
map.OWSDispatch(req);</font><font face="Courier New"><br>
</font><font face="Courier New"><br>
</font><font face="Courier New">
context.Response.ContentType =
mapscript.msIO_stripStdoutBufferContentType();</font><font face="Courier New"><br>
</font><font face="Courier New">
context.Response.BinaryWrite(mapscript.msIO_getStdoutBufferBytes());</font><font face="Courier New"><br>
</font><font face="Courier New">
mapscript.msIO_resetHandlers();</font><font face="Courier New"><br>
</font><font face="Courier New"><br>
</font><font face="Courier New">OpenLayers:</font><font face="Courier New"><br>
</font><font face="Courier New"> var wfs = new
OpenLayers.Layer.Vector("WFSCELL", {</font><font face="Courier
New"><br>
</font><font face="Courier New"> strategies:
[new OpenLayers.Strategy.BBOX()],</font><font face="Courier
New"><br>
</font><font face="Courier New">
isBaseLayer: true,</font><font face="Courier New"><br>
</font><font face="Courier New"> styleMap:
styleMap,</font><font face="Courier New"><br>
</font><font face="Courier New"> service:
wfs,</font><font face="Courier New"><br>
</font><font face="Courier New"> Version:
"1.0.0",</font><font face="Courier New"><br>
</font><font face="Courier New">
TypeName:"cell",</font><font face="Courier New"><br>
</font><font face="Courier New"> protocol:
new OpenLayers.Protocol.WFS({</font><font face="Courier New"><br>
</font><font face="Courier New"> url:
"MapWFS.ashx",</font><font face="Courier New"><br>
</font><font face="Courier New">
featureType: "cell",</font><font face="Courier New"><br>
</font><font face="Courier New">
featurePrefix: "cs" ,</font><font face="Courier New"><br>
</font><font face="Courier New">
featureNS: "<a href="http://www.openplans.org/topp" target="_blank">http://www.openplans.org/topp</a>",</font><font face="Courier New"><br>
</font><font face="Courier New">
geometryName: 'msGeometry'</font><font face="Courier New"><br>
</font><font face="Courier New"><br>
</font><font face="Courier New"><br>
</font><font face="Courier New"> })</font><font face="Courier New"><br>
</font><font face="Courier New"> });</font><font face="Courier New"><br>
</font><font face="Courier New"> wfs.isBaseLayer = true;</font><font face="Courier New"><br>
</font><font face="Courier New"> map.addLayer(wfs);</font><font face="Courier New"><br>
</font><font face="Courier New"><br>
</font><font face="Courier New"><br>
</font><font face="Courier New">content of the post-request:</font><font face="Courier New"><br>
<br>
</font><font face="Courier New"><code></code></font><font face="Courier
New"><wfs:GetFeature xmlns:wfs="<a href="http://www.opengis.net/wfs" target="_blank">http://www.opengis.net/wfs</a>"
service="WFS" version="1.0.0"
xsi:schemaLocation="<a href="http://www.opengis.net/wfs" target="_blank">http://www.opengis.net/wfs</a>
<a href="http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" target="_blank">http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd</a>"
xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>"><br>
<wfs:Query typeName="cs:cell"
xmlns:cosunet="<a href="http://www.openplans.org/topp" target="_blank">http://www.openplans.org/topp</a>"><br>
<ogc:Filter xmlns:ogc="<a href="http://www.opengis.net/ogc" target="_blank">http://www.opengis.net/ogc</a>"><br>
<ogc:BBOX><br>
<ogc:PropertyName>msGeometry</ogc:PropertyName><br>
<gml:Box xmlns:gml="<a href="http://www.opengis.net/gml" target="_blank">http://www.opengis.net/gml</a>"
srsName="EPSG:4326"><gml:coordinates decimal="." cs="," ts="
">110.298828125,28.1875
127.701171875,33.8125</gml:coordinates></gml:Box><br>
</ogc:BBOX><br>
</ogc:Filter><br>
</wfs:Query><br>
<br>
<br>
<br>
</wfs:GetFeature><br>
</font><br><br><hr>From: <a href="mailto:wingicelee@hotmail.com">wingicelee@hotmail.com</a><br>To: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>Date: Thu, 9 Sep 2010 00:44:30 +0000<br>
Subject: [mapserver-users] C# mapscripts and WFS Service , xml-encoded Post Request with openlayers<div><div></div><div class="h5"><br><br>
Hi, I 'm currently deploying a WFS Server with C# mapscripts. The Request issued by openlayers is xml-encoded post request.<br>When I tried to use "loadparam", it exited abnormally. So I had to parse parameter by myself. So my question is: do I have to parse the xml-encoded post request manually?<br>
is there a function I can use to parse the post request?<br><br><br>Thanks and Best Request,<br>William<br><br>
<br></div></div>_______________________________________________
mapserver-users mailing list
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a> </div>
<br>_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br></blockquote></div><br><hints id="hah_hints"><span id="hah_hint_248" name="hah_hint" style="z-index: 500; font: x-small helvetica; color: buttontext; background-color: buttonface; border: 1px solid buttonshadow; -moz-border-radius: 0.3em 0.3em 0.3em 0.3em; padding: 0px 3px; position: absolute; display: none; top: 0px; left: 0px;">SZZ</span><span id="hah_hint_248" name="hah_hint" style="z-index: 500; font: x-small helvetica; color: buttontext; background-color: buttonface; border: 1px solid buttonshadow; -moz-border-radius: 0.3em 0.3em 0.3em 0.3em; padding: 0px 3px; position: absolute; display: none; top: 0px; left: 0px;">SZZ</span><span id="hah_hint_248" name="hah_hint" style="z-index: 500; font: x-small helvetica; color: buttontext; background-color: buttonface; border: 1px solid buttonshadow; -moz-border-radius: 0.3em 0.3em 0.3em 0.3em; padding: 0px 3px; position: absolute; display: none; top: 0px; left: 0px;">SZZ</span><span id="hah_hint_248" name="hah_hint" style="z-index: 500; font: x-small helvetica; color: buttontext; background-color: buttonface; border: 1px solid buttonshadow; -moz-border-radius: 0.3em 0.3em 0.3em 0.3em; padding: 0px 3px; position: absolute; display: none; top: 0px; left: 0px;">SZZ</span><span id="hah_hint_248" name="hah_hint" style="z-index: 500; font: x-small helvetica; color: buttontext; background-color: buttonface; border: 1px solid buttonshadow; -moz-border-radius: 0.3em 0.3em 0.3em 0.3em; padding: 0px 3px; position: absolute; display: none; top: 0px; left: 0px;">SZZ</span></hints> </body>
</html>