[mapserver-users] C# mapscripts and WFS Service , xml-encoded	Post Request with openlayers
    Fuming Li 
    wingicelee at hotmail.com
       
    Thu Sep  9 22:49:55 PDT 2010
    
    
  
Hi, I 'm currently deploying a WFS Server with C# mapscripts.  The 
Request issued by openlayers is xml-encoded post request.
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?
is there a function I can use to 
parse the post request?
WFS Service:
public class MapWFS : IHttpHandler {
   
    public void ProcessRequest 
(HttpContext context) {
        try
        {
            OWSRequest req = 
new OWSRequest();
            
System.Collections.Specialized.NameValueCollection queryStr = 
context.Request.Params;
            
//req.loadParams();  can't call this function, it will exit immediately.
            
req.setParameter("service", "WFS");
            
req.setParameter("version", "1.0.0");
            
req.setParameter("request", "getFeature");
 
            for (int i = 0; i 
< queryStr.Count; ++i)
            {
                
req.setParameter(queryStr.GetKey(i), queryStr.Get(i));
           }
            
            string mapFileName =
 ConfigurationManager.AppSettings["MapFilePath"];
            mapObj map = new 
mapObj(context.Server.MapPath(mapFileName));
    ...
            
            
mapscript.msIO_installStdoutToBuffer();
            
map.OWSDispatch(req);
            
context.Response.ContentType = 
mapscript.msIO_stripStdoutBufferContentType();
            
context.Response.BinaryWrite(mapscript.msIO_getStdoutBufferBytes());
            
mapscript.msIO_resetHandlers();
OpenLayers:
            var wfs = new 
OpenLayers.Layer.Vector("WFSCELL", {
                    strategies:
 [new OpenLayers.Strategy.BBOX()],
                    
isBaseLayer: true,
                    styleMap: 
styleMap,
                    service: 
wfs,
                    Version: 
"1.0.0",
                    
TypeName:"cell",
                    protocol: 
new OpenLayers.Protocol.WFS({
                        url: 
"MapWFS.ashx",
                        
featureType: "cell",
                        
featurePrefix: "cs" ,
                        
featureNS: "http://www.openplans.org/topp",
                        
geometryName: 'msGeometry'
                    })
                });
        wfs.isBaseLayer = true;
        map.addLayer(wfs);
content of the post-request:
  
<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">
    <wfs:Query typeName="cs:cell" 
xmlns:cosunet="http://www.openplans.org/topp">
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
               <ogc:BBOX>
                   
<ogc:PropertyName>msGeometry</ogc:PropertyName>
                   <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>
               </ogc:BBOX>
          </ogc:Filter>
</wfs:Query>
  
  
  
</wfs:GetFeature>
From: wingicelee at hotmail.com
To: mapserver-users at lists.osgeo.org
Date: Thu, 9 Sep 2010 00:44:30 +0000
Subject: [mapserver-users] C# mapscripts and WFS Service , xml-encoded Post Request with openlayers
Hi, I 'm currently deploying a WFS Server with C# mapscripts.  The Request issued by openlayers is xml-encoded post request.
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?
is there a function I can use to parse the post request?
Thanks and Best Request,
William
 		 	   		  
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100910/360f3877/attachment.htm>
    
    
More information about the MapServer-users
mailing list