<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" fontSize="12">

 

      <mx:Script>
       <![CDATA[
        import mx.events.ResizeEvent;
        
        import mx.controls.Alert;
        import mx.rpc.events.ResultEvent;
        
        protected function init():void{
         Alert.show("阿拉山口的附件","提示");
//         ws.loadWSDL();
        }
           
           private function onResult(evt:ResultEvent):void
           {
//            var msg:String=evt.target.name;
                 Alert.show(evt.result.toString());
           }
           internal function onResultP(evt:ResultEvent):void{
            Grid.dataProvider=WS.getInfo.lastResult.Tables.Table.Rows;
           }
          
           internal function onResult2(evt:ResultEvent):void{
            myGrid.dataProvider = WS.GetList.lastResult;
           }
           internal function onResultPL(evt:ResultEvent):void{
            Grid.dataProvider=WS.GetPList.lastResult;
           }
       ]]>
      </mx:Script>

 <mx:Button x="50" y="51" label="单击我" fontSize="12" click="init()"/>
 <mx:Button x="26" y="209" label="获取webservice的信息" fontSize="12" click="WS.HelloWorld.send()"/>
 <mx:Button x="129" y="291" label="返回DataTable" width="118" click="WS.getInfo.send()"/>
 <mx:Button x="129" y="337" label="返回List" width="118" click="WS.GetPList.send()"/>

    <mx:Button label="返回List(泛型)" click="WS.GetList.send();" x="131" y="457"></mx:Button>

 //wsdl为引用的webservice的地址
 <mx:WebService >        <mx:request>

//此处的<name>表示为HelloWorld方法中的参数
      <name>{txt.text}</name>
      <age>45</age>
       </mx:request>
  </mx:operation>
  <mx:operation name="getInfo" resultFormat="object" result="onResultP(event)"/>
  <mx:operation name="GetPList" resultFormat="object" result="onResultPL(event)"/> 
   
   
  <mx:operation name="GetList" result="onResult2(event);"/>

   
 </mx:WebService>
 <mx:TextInput />

//绑定数据
 <mx:DataGrid > </mx:DataGrid>


</mx:Application>

相关文章: