0 Replies Latest reply on Apr 3, 2008 2:53 PM by MaxCardoso

    .NET WebService FLEX 3


      Hello! I've been using Flex !

      I Traying to use the code to handling de .Net webservice result to a Data Grid using Flex 3 but the code doesno't work.
      I don't have error message, but de grid is empty.

      What is wrong ?!



      Web Service Result

      <getCampanhasResponse xmlns=" http://tempuri.org/" xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=" http://www.w3.org/2001/XMLSchema">


      <xsd:schema id="NewDataSet" xmlns:xs=" http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

      <xsd:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="Mailinglist" msdata:UseCurrentLocale="true">


      <xsd:choice minOccurs="0" maxOccurs="unbounded">

      <xsd:element name="Mailinglist">



      <xsd:element name="IdMailing" type="xs:string" minOccurs="0"/>

      <xsd:element name="noMailing" type="xs:string" minOccurs="0"/>

      <xsd:element name="prospects" type="xs:string" minOccurs="0"/>

      <xsd:element name="Discagem" type="xs:string" minOccurs="0"/>








      <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">


      <Mailinglist diffgr:id="Mailinglist1" msdata:rowOrder="0">


      <noMailing>02 Ativo LD</noMailing>




      <Mailinglist diffgr:id="Mailinglist2" msdata:rowOrder="1">


      <noMailing>02 Ativo LD</noMailing>








      // Namespace Declarations

      private namespace wsDiscador = " http://tempuri.org/";

      use namespace wsDiscador;

      //holds the result xml to Show on Alert – for test only

      [Bindable]private var _xmlResult:XML;

      // WebService Call **** Copy From

      // http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_6.html

      private function onResult(event:ResultEvent):void {


      // A DataTable or DataSet returned from a .NET webservice is

      // automatically converted to an object with a "Tables" property,

      // which contains a map of one or more dataTables.

      _xmlResult = XML(event.result);

      Alert.show(_xmlResult.toString()); // Show de Result of Web Service – OK ;-)

      if (event.result.Tables != null)


      // clean up panel from previous calls.


      for each (var table:Object in event.result.Tables)




      // Alternatively, if a table's name is known beforehand,

      // it can be accessed using this syntax:

      var namedTable:Object = event.result.Tables.Mailinglist;

      // displayTable(namedTable);



      private function displayTable(tbl:Object):void {

      var dg:DataGrid = new DataGrid();


      // Each table object from the "Tables" map contains two properties:

      // "Columns" and "Rows". "Rows" is where the data is, so we can set

      // that as the dataProvider for a DataGrid.

      dg.dataProvider = tbl.Rows;


      // MXML Call WebService

      <mx:WebService id="wsGetDiscador"


      wsdl = " http://localhost:2019/DialMonitor_C/Service.asmx?wsdl"

      fault="Alert.show(event.fault.faultString, 'Erro de acesso ao servidor.');"

      useProxy="false" >

      <mx:operation name="getCampanhas"

      fault="Alert.show(event.fault.faultString, 'Erro no método de acesso.');"

      resultFormat="e4x" result="onResult(event)">



      <mx:Panel id="dataPanel" width="100%" height="100%" title="Data Tables"/>