EX01

Flexから、s2axis-examplesのEX01を呼び出してみる。

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
  <mx:TextInput id="echoText" left="10" top="10" width="160"/>
  <mx:Button label="testEcho" click="testClick()" left="178" top="10"/>
  <mx:Label id="echoLabel" left="262" right="10" top="12" text="result"/>

  <mx:WebService id="webService" wsdl="http://localhost:8080/s2axis-examples/services/EchoHandler?wsdl">
    <mx:operation name="doIt" result="testResult(event)" fault="testFault(event)">
      <mx:request xmlns="">
        <message>"Hello"</message>
      </mx:request>
    </mx:operation>
  </mx:WebService>
  
  <mx:Script>
    <![CDATA[
      import mx.controls.Alert;
      import mx.rpc.events.ResultEvent;

      private function testClick(): void {
        webService.doIt(echoText.text);
      }
      
      private function testResult(event: ResultEvent): void {
        echoLabel.text = event.result as String;
      }

      private function testFault(event: Event): void {
        Alert.show(event.toString());
      }
    ]]>
  </mx:Script>
</mx:Application>