<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
internal function sendMessage():void
{
//myWebService.send();
myWebService.HelloWorld.send();
}
internal function DoWork(evt:ResultEvent):void
{
txtArea.text=evt.result.toString();
}
internal function DoError(evt:FaultEvent):void
{
txtArea.text=evt.fault.toString();
}
]]>
</mx:Script>
<mx:WebService
id="myWebService"
wsdl="http://localhost:1918/Service1.asmx?wsdl"
showBusyCursor="true"
result="DoWork(event)"
fault="DoError(event)">
<mx:operation name="HelloWorld">
<!--<mx:request>
<input>
{txtInput.text}
</input>
</mx:request>-->
</mx:operation>
</mx:WebService>
<mx:Panel x="40" y="41" width="361" height="293" layout="absolute">
<mx:Button x="207" y="23" label="返回service结果" click="sendMessage()"/>
<mx:TextInput x="10" y="23" id="txtInput" width="189"/>
<mx:TextArea id= "txtArea" left="9" right="10" top="63" bottom="20"/>
</mx:Panel>
</mx:Application>