• 利用actionscript访问wfs服务


    以后整理……</>

     1     private function search_clickHandler():void{
     2                 op="search";
     3                 
     4                 var urlLoader:URLLoader=new URLLoader(); 
     5                 var resultStr:String;  
     6                 var request:URLRequest;
     7                 var urlVariables:URLVariables;  
     8                  var url:String="http://192.168.3.200:8399/arcgis/services/st/poi/MapServer/WFSServer";
     9                 configureListeners(urlLoader);//给urlloader对象添加监听事件  
    10                 urlVariables=new URLVariables();  
    11                 urlVariables.request = "GetFeature";  
    12                 //urlVariables.request = "GetCapabilities";  
    13                 urlVariables.service = "WFS";  
    14                 urlVariables.typeName = "Poi";  
    15                 urlVariables.version = "1.0.0";  
    16                 urlVariables.BBOX = "120.5279,31.2890,120.9680,31.2332";  
    17                 request= new URLRequest(url);  
    18                 //URLRequest 类可捕获单个 HTTP 请求中的所有信息。  
    19                 //URLRequest 对象将传递给 Loader、URLStream 和 URLLoader 类的 load() 方法和其他加载操作,以便启动 URL 下载。  
    20             //    Alert.show("you");  
    21                 request.data = urlVariables;//将url请求的数据放入request中  
    22                 request.method = URLRequestMethod.GET;//设置请求的类型  
    23                 try {  
    24                     urlLoader.load(request);//开始发送请求  
    25                     
    26                 } catch (error:Error) {  
    27                     Alert.show(error.message);  
    28                 }  
    29                 function configureListeners(dispatcher:IEventDispatcher):void {    
    30                     //加载完成事件;    
    31                     dispatcher.addEventListener(Event.COMPLETE, loaderHandler);    
    32                     //开始访问事件;    
    33                     dispatcher.addEventListener(Event.OPEN, loaderHandler);    
    34                     //加载进度事件;    
    35                     dispatcher.addEventListener(ProgressEvent.PROGRESS, loaderHandler);    
    36                     //跨域访问安全策略事件;    
    37                     dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderHandler);    
    38                     //Http状态事件;    
    39                     dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, loaderHandler);    
    40                     //访问出错事件;    
    41                     dispatcher.addEventListener(IOErrorEvent.IO_ERROR, loaderHandler);   
    42                 }   
    43                 function loaderHandler(event:*):void   
    44                 {   
    45                     switch(event.type) {   
    46                         case Event.COMPLETE:   
    47                             //Alert.show("成功: "); 
    48                             //Alert.show(typeof urlLoader.data);
    49                             resultStr=String(urlLoader.data);//请求成功,并取得返回值  
    50                             if(resultStr!=null&&resultStr!=""){
    51                                 var xml:XML=new XML(resultStr);
    52                                 Alert.show(xml.children()[0].toString());
    53                             }
    54                             break;   
    55                         case Event.OPEN:   
    56                             //Alert.show("open: " + event);   
    57                             break;   
    58                         case ProgressEvent.PROGRESS:   
    59                             //Alert.show("progress: " + event);   
    60                             break;   
    61                         case SecurityErrorEvent.SECURITY_ERROR:   
    62                             Alert.show("securityError: " + event);   
    63                             break;   
    64                         case HTTPStatusEvent.HTTP_STATUS:   
    65                             //Alert.show("httpStatus: " + event);   
    66                             break;   
    67                         case IOErrorEvent.IO_ERROR:   
    68                             Alert.show("ioError: " + event);   
    69                             break;   
    70                         
    71                     }   
    72                 }  

    待整理……

     1 private function search_clickHandler():void{
     2                 op="search";
     3                 
     4                 var urlLoader:URLLoader=new URLLoader(); 
     5                 urlLoader.dataFormat=URLLoaderDataFormat.BINARY;
     6                 var resultStr:String;  
     7                 var request:URLRequest;
     8                 var urlVariables:URLVariables;  
     9                  var url:String="http://192.168.3.200:8399/arcgis/services/st/poi/MapServer/WFSServer";
    10                 configureListeners(urlLoader);//给urlloader对象添加监听事件  
    11                 urlVariables=new URLVariables();  
    12                 urlVariables.request = "GetFeature";  
    13                 //urlVariables.request = "GetCapabilities";
    14                 urlVariables.service = "WFS";  
    15                 urlVariables.typeName = "Poi";  
    16                   urlVariables.version = "1.1.0";  
    17                  // urlVariables.BBOX = "120.5279,31.2890,120.9680,31.2332"; 
    18                  var params:String='<ogc:Filter>'+
    19                      '<ogc:PropertyIsEqualTo>'+
    20                      '<ogc:PropertyName>SHP_ID</ogc:PropertyName>'+
    21                      '<ogc:Literal>'+'F47015031B134C399BB73E4DBFB83365'+'</ogc:Literal>'+
    22                      '</ogc:PropertyIsEqualTo>'+
    23                      '</ogc:Filter>';
    24 /*                  var params:String='<ogc:Filter><ogc:BBOX><ogc:PropertyName>Shape</ogc:PropertyName> <gml:Box srsName="EPSG:4326">'+
    25                           '<gml:coordinates>31.2890,120.5279 31.2332,120.9680</gml:coordinates>'+
    26                           '</gml:Box></ogc:BBOX></ogc:Filter>'; */
    27                 urlVariables.Filter= params; 
    28                 request= new URLRequest(url);  
    29                 //URLRequest 类可捕获单个 HTTP 请求中的所有信息。  
    30                 //URLRequest 对象将传递给 Loader、URLStream 和 URLLoader 类的 load() 方法和其他加载操作,以便启动 URL 下载。  
    31             //    Alert.show("you");  
    32                 request.data = urlVariables;//将url请求的数据放入request中  
    33                 request.method = URLRequestMethod.GET;//设置请求的类型  
    34                 
    35                 try {  
    36                     urlLoader.load(request);//开始发送请求  
    37                     
    38                 } catch (error:Error) {  
    39                     Alert.show(error.message);  
    40                 }  
    41                 function configureListeners(dispatcher:IEventDispatcher):void {    
    42                     //加载完成事件;    
    43                     dispatcher.addEventListener(Event.COMPLETE, loaderHandler);    
    44                     //开始访问事件;    
    45                     dispatcher.addEventListener(Event.OPEN, loaderHandler);    
    46                     //加载进度事件;    
    47                     dispatcher.addEventListener(ProgressEvent.PROGRESS, loaderHandler);    
    48                     //跨域访问安全策略事件;    
    49                     dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loaderHandler);    
    50                     //Http状态事件;    
    51                     dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, loaderHandler);    
    52                     //访问出错事件;    
    53                     dispatcher.addEventListener(IOErrorEvent.IO_ERROR, loaderHandler);   
    54                 }   
    55                 function loaderHandler(event:*):void   
    56                 {   
    57                     switch(event.type) {   
    58                         case Event.COMPLETE:   
    59                             //Alert.show("成功: "); 
    60                             //Alert.show(typeof urlLoader.data);
    61                             var bt:ByteArray = urlLoader.data;
    62                             
    63                             resultStr = bt.readMultiByte(bt.length,"utf-8"); 
    64                               
    65                             if(resultStr!=null&&resultStr!=""){
    66                                 var xml:XML=new XML(resultStr);
    67                                 Alert.show(xml.toString());
    68                             }
    69                             break;   
    70                         case Event.OPEN:   
    71                             //Alert.show("open: " + event);   
    72                             break;   
    73                         case ProgressEvent.PROGRESS:   
    74                             //Alert.show("progress: " + event);   
    75                             break;   
    76                         case SecurityErrorEvent.SECURITY_ERROR:   
    77                             Alert.show("securityError: " + event);   
    78                             break;   
    79                         case HTTPStatusEvent.HTTP_STATUS:   
    80                             //Alert.show("httpStatus: " + event);   
    81                             break;   
    82                         case IOErrorEvent.IO_ERROR:   
    83                             Alert.show("ioError: " + event);   
    84                             break;   
    85                         
    86                     }   
    87                 }  
  • 相关阅读:
    MYSQL注入天书之HTTP头部介绍
    Sqli-labs less 18
    Sqli-labs less 19
    Sqli-labs less 20
    Sqli-labs less 21
    Sqli-labs less 22
    Python3之PrettyTable模块
    python设计模式
    python3反射解析
    Python3异常处理
  • 原文地址:https://www.cnblogs.com/shizhongtao/p/3455341.html
Copyright © 2020-2023  润新知