2 Replies Latest reply on Apr 8, 2010 9:13 AM by t002102bd

    Pulling Data from an imported web service into a data grid - Flex 3.0

    t002102bd

      Hi all,

       

      I have created a web service from Oracle using JDeveloper and imported it into my Fex 3 project, and I am trying to populate a data grid with the data from the web service.  I was trying to emulate the example found in my Adobe Flex 3.0 for Dummies book (see http://dougmccune.com/flexfordummies/chapter14/srcview/index.html), and while the code from the book with that data service works fine, I can't get my application to work.  My issue is with the part of code mx:DataGrid dataProvider="(service)"  - I do not know how to specify what to use for the data source to populate the data grid from my imported web service.  Any suggestions or examples would be helpful, as I am a newcomer to Adobe Flex.  My code is as follows:

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application

       

      xmlns:mx="http://www.adobe.com/2006/mxml"

      xmlns:webservices="

      generated.webservices.*">

       

       

      <mx:Script>

      <![CDATA[

       

      private function getData():void {

      service.getPdRec(ageDt.text);

      }

      ]]>

       

      </mx:Script>

       

       

      <webservices:PD_Pct_Web_Service id="service" />

       

       

       

      <mx:VBox>

       

      <mx:HBox width="100%">

       

      <mx:TextInput id="ageDt" width="100%" />

       

      <mx:Button id="submitButton" label="Search" click="getData()" />

       

      </mx:HBox>

       

       

      <mx:DataGrid dataProvider="

      (

      service.getPdRec_lastResult

       

      )

       

      )

      "

      rowHeight="

      58" width="100%" height="300">

       

      <mx:columns>

       

      <mx:DataGridColumn dataField="creditManager" headerText="Credit Manager" width="40" />

       

      <mx:DataGridColumn dataField="pdTarget" headerText="PD Target" width="40" />

       

      <mx:DataGridColumn dataField="totalPd" headerText="Total PD" width="40" />

       

      <mx:DataGridColumn dataField="pdPct" headerText="PD Percent" width="50" />

       

      </mx:columns>

       

      </mx:DataGrid>

       

      </mx:VBox>

       

      </mx:Application>

       

      My web service returns the following when invoked:

       

      <env:Envelope
        xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:ns0="http://erec_db/PD_Pct_Web_Service.wsdl/types/">
      <env:Body>
        <ns0:getPdRecResponseElement>
         <ns0:result>
          <ns0:creditManager>Cobb</ns0:creditManager>
          <ns0:pdTarget>10</ns0:pdTarget>
          <ns0:totalPd>147.65</ns0:totalPd>
          <ns0:pdPct>26.77</ns0:pdPct>
         </ns0:result>
         <ns0:result>
          <ns0:creditManager>Collova</ns0:creditManager>
          <ns0:pdTarget>10</ns0:pdTarget>
          <ns0:totalPd>27.71</ns0:totalPd>
          <ns0:pdPct>21.67</ns0:pdPct>
         </ns0:result>
         <ns0:result>
          <ns0:creditManager>Lee</ns0:creditManager>
          <ns0:pdTarget>10</ns0:pdTarget>
          <ns0:totalPd>33.61</ns0:totalPd>
          <ns0:pdPct>72.38</ns0:pdPct>
         </ns0:result>
         <ns0:result>
          <ns0:creditManager>Maynard</ns0:creditManager>
          <ns0:pdTarget>10</ns0:pdTarget>
          <ns0:totalPd>74.19</ns0:totalPd>
          <ns0:pdPct>33.69</ns0:pdPct>
         </ns0:result>
         <ns0:result>
          <ns0:creditManager>Ong</ns0:creditManager>
          <ns0:pdTarget>10</ns0:pdTarget>
          <ns0:totalPd>13.26</ns0:totalPd>
          <ns0:pdPct>46.06</ns0:pdPct>
         </ns0:result>
        </ns0:getPdRecResponseElement>
      </env:Body>
      </env:Envelope>