4 Replies Latest reply on Feb 24, 2009 9:23 AM by phillipus_rex

    Flex and SOAP - Problem Loading Data - Help!

    phillipus_rex
      If you are good at Flex Web Services and SOAP I could really use your help.... I am new to this and I really need to get this working quickly.

      I am trying to pull data from a different domain and put it into a datagrid in my Flex app, but nothing I've tried has worked. I have also put the crossdomain.xml file into the root folder of the site as it is described in the Adobe documentation. I have a SoapHeader object with my login information like it is on the documentation as well, but still no luck.

      Please look at my code and let me know where I may have went wrong. I included the contents of the script tag and the web service code itself.

      Thanks in advance.




      ****************************************** SCRIPT ******************************************

      <mx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;
      import mx.rpc.soap.SOAPHeader;

      private var header1:SOAPHeader;

      [Bindable]
      private var myData:ArrayCollection;

      private function getData():void
      {
      myService.GetViewDefinition("Patient Conditions", false);
      }

      private function resultHandler(event:ResultEvent):void
      {
      myData = event.result.Tables.Table0.Rows as ArrayCollection;
      }

      public function headers():void
      {
      var q1:QName = new QName("https://www.mySite.com/DataService/Data.asmx", "Header1");
      header1 = new SOAPHeader(q1, {string:"myLogin", string:"myPassword"});

      myService.addHeader(header1);
      }

      ]]>
      </mx:Script>


      ****************************************** WEB SERVICE ******************************************

      <mx:WebService id="myService"
      wsdl="https://www.mySite.com/dataservice/data.asmx?WSDL"
      load="getData()"
      result="resultHandler(event)"/>