1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" > <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; import mx.controls.Alert; import mx.utils.URLUtil; private function testWebServiceSuccess(event:ResultEvent):void { this.txtValue.text = event.result.toString(); } private function testWebServiceFault(event:FaultEvent):void { Alert.show(event.fault.faultString + "-" + event.fault.faultDetail + "-" + event.fault.faultCode, "Error"); } private function testWebServiceClick():void { wsx.ConversionRate("USD","COP"); } ]]> </mx:Script> <mx:Text x="92" y="55" text="Value:" id="lblValue"/> <mx:TextInput x="145" y="53" id="txtValue"/> <mx:Button x="204" y="83" label="Invoke WS" id="btnInvokeWS" click="testWebServiceClick()"/> <mx:WebService id="wsx" wsdl="http://www.webservicex.net/CurrencyConvertor.asmx?wsdl" showBusyCursor="true"> <mx:operation name="ConversionRate" resultFormat="object" result="testWebServiceSuccess(event)" fault="testWebServiceFault(event)"> </mx:operation> </mx:WebService> </mx:Application>