1 Reply Latest reply on Nov 27, 2006 11:11 AM by Bill Sahlas

    Flex 2.0 WebService woes

    Flex2Flash
      I am experiencing problems with the <mx:WebService> capability within my Flex 2.0 applications. Please find attached a brief sample that should help to illustrate the problems.

      If you compile and run the attached code with the default input, you should see the web-service call results in a fault during the decode sequence. However, if you run the same example with the following web-based soap client (note you must supply the URL of the corresponding WSDL), you should see that the web-service works fine.

      http://www.soapclient.com/soapclient.com/soaptest.html
      http://www.lyricwiki.org/server.php?wsdl

      Interestingly enough, the web-service call within the supplied Flex application does not fail when supplying input that is not found, such as when modifying the default artist input to ”Beagles”.

      I can’t imagine a simpler web-service test within a Flex 2.0 application, nor can I see any coding mistakes based upon my understanding after thoroughly reading the supplied Flex 2.0 documentation.

      Regards.



      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:Script>
      private function doRequest():void {
      lyricsRequest.getSongResult.request.artist = artist.text;
      lyricsRequest.getSongResult.request.song = song.text;
      lyricsRequest.getSongResult.send();
      }
      </mx:Script>
      <mx:WebService id="lyricsRequest"
      fault="lyrics.text = event.toString() + event.message.body;"
      result="lyrics.text = event.result.lyrics;"
      wsdl=" http://www.lyricwiki.org/server.php?wsdl">
      </mx:WebService>
      <mx:Panel>
      <mx:Form defaultButton="{ok}">
      <mx:FormItem label="Artist">
      <mx:TextInput id="artist" text="Eagles" />
      </mx:FormItem>
      <mx:FormItem label="Song">
      <mx:TextInput id="song" text="Hotel California" />
      </mx:FormItem>
      </mx:Form>
      <mx:TextArea id="lyrics" width="400" height="100" wordWrap="true" />
      <mx:ControlBar>
      <mx:Button id="ok" click="doRequest();" label="OK" />
      </mx:ControlBar>
      </mx:Panel>
      </mx:Application>