<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
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>
WFS Service:<br>
<br>
<font style="" face="Courier New">public class MapWFS : IHttpHandler {</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"> 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"><br>
</font><font style="" face="Courier New">
System.Collections.Specialized.NameValueCollection queryStr =
context.Request.Params;</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">
//req.loadParams(); can't call this function, it will exit immediately.</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">
req.setParameter("service", "WFS");</font><font style="" face="Courier
New"><br>
</font><font style="" face="Courier New">
req.setParameter("version", "1.0.0");</font><font style="" face="Courier
New"><br>
</font><font style="" face="Courier New">
req.setParameter("request", "getFeature");</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"> for (int i = 0; i
< queryStr.Count; ++i)</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">
req.setParameter(queryStr.GetKey(i), queryStr.Get(i));</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"> </font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> string mapFileName =
ConfigurationManager.AppSettings["MapFilePath"];</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> mapObj map = new
mapObj(context.Server.MapPath(mapFileName));</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"> </font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">
mapscript.msIO_installStdoutToBuffer();</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">
map.OWSDispatch(req);</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">
context.Response.ContentType =
mapscript.msIO_stripStdoutBufferContentType();</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">
context.Response.BinaryWrite(mapscript.msIO_getStdoutBufferBytes());</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">
mapscript.msIO_resetHandlers();</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">OpenLayers:</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> var wfs = new
OpenLayers.Layer.Vector("WFSCELL", {</font><font style="" face="Courier
New"><br>
</font><font style="" face="Courier New"> strategies:
[new OpenLayers.Strategy.BBOX()],</font><font style="" face="Courier
New"><br>
</font><font style="" face="Courier New">
isBaseLayer: true,</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> styleMap:
styleMap,</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> service:
wfs,</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> Version:
"1.0.0",</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">
TypeName:"cell",</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> protocol:
new OpenLayers.Protocol.WFS({</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> url:
"MapWFS.ashx",</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">
featureType: "cell",</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">
featurePrefix: "cs" ,</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">
featureNS: "http://www.openplans.org/topp",</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">
geometryName: 'msGeometry'</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"><br>
</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"> });</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> wfs.isBaseLayer = true;</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> map.addLayer(wfs);</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">content of the post-request:</font><font style="" face="Courier New"><br>
<br>
</font><font style="" face="Courier New"><code role="listitem" class="focusRow subFocusRow "></code></font><font style="" face="Courier
New"><wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs"
service="WFS" version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><br>
<wfs:Query typeName="cs:cell"
xmlns:cosunet="http://www.openplans.org/topp"><br>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><br>
<ogc:BBOX><br>
<ogc:PropertyName>msGeometry</ogc:PropertyName><br>
<gml:Box xmlns:gml="http://www.opengis.net/gml"
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 id="stopSpelling">From: wingicelee@hotmail.com<br>To: mapserver-users@lists.osgeo.org<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<br><br>
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
</style>
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>_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users </body>
</html>