1 Reply Latest reply on Feb 5, 2008 12:53 PM by Bill Sahlas

    Authentication with web service with flax

    nargis_himani Level 1
      hi,

      i m creating a application in which i m using web services from flex. i have username n password but still it gives me error security error accessing url.
      i give my below. plz give me some solution.
      do i need to change flex-config.xml file. if yes the what to do with that .

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" >
      <mx:Script>
      <![CDATA[
      import mx.rpc.events.FaultEvent;
      import mx.rpc.events.ResultEvent;
      import mx.controls.Alert;

      private function echoLoginHandler(event:ResultEvent):void{
      Alert.show(event.result.toString());
      }

      private function echoModeHandler(event:ResultEvent):void{
      Alert.show(event.result.toString());
      }

      private function sendRequest():void{
      UserWebService.Mode.send();
      // UserWebService.Login.send();
      Alert.show("hello");

      }

      public function faultHandler(event:FaultEvent):void {
      Alert.show(event.fault.faultString + "Error");

      }
      ]]>
      </mx:Script>
      <mx:Form >
      <mx:FormItem label="UserID" required="true">
      <mx:TextInput id="usernm"/>
      </mx:FormItem>
      <mx:FormItem label="Password" required="true">
      <mx:TextInput id="passwd" displayAsPassword="true"/>
      </mx:FormItem>
      <mx:FormItem>
      <mx:HBox>
      <mx:Button id="Login" label="Log in" click="sendRequest()"/>
      </mx:HBox>
      </mx:FormItem>
      </mx:Form>



      <mx:WebService id="UserWebService"
      wsdl=" http://wssenv3/mysite/_vti_bin/Authentication.asmx?WSDL"
      destination="UserWebService"
      showBusyCursor="true"
      fault="faultHandler(event)" makeObjectsBindable="true" >
      <mx:operation name="Login" result="echoLoginHandler(event)">
      <mx:request>
      <username>{usernm.text}</username>
      <password>{passwd.text}</password>
      </mx:request>
      </mx:operation>
      <mx:operation name="Mode" result="echoModeHandler(event)" fault="Alert.show(event.fault.faultString)">
      <mx:request>

      </mx:request>
      </mx:operation>
      </mx:WebService>
      </mx:Application>