Expand my Community achievements bar.

.NET WebService FLEX 3

Avatar

Level 1




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 ?!



Thanks

Max



___________________________________________________________________________





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">



<getCampanhasResult>



<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:complexType>



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



<xsd:element name="Mailinglist">



<xsd:complexType>



<xsd:sequence>



<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"/>



</xsd:sequence>



</xsd:complexType>



</xsd:element>



</xsd:choice>



</xsd:complexType>



</xsd:element>



</xsd:schema>



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



<DocumentElement>



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



<IdMailing>01</IdMailing>



<noMailing>02 Ativo LD</noMailing>



<prospects>1000</prospects>



<Discagem>500</Discagem>



</Mailinglist>



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



<IdMailing>02</IdMailing>



<noMailing>02 Ativo LD</noMailing>



<prospects>2000</prospects>



<Discagem>600</Discagem>



</Mailinglist>



</DocumentElement>



</diffgr:diffgram>



</getCampanhasResult>



</getCampanhasResponse>















// 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 {



CursorManager.removeBusyCursor();



// 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.







dataPanel.removeAllChildren();











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



{



displayTable(table);



}







// 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();



dataPanel.addChild(dg);



// 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"



showBusyCursor="true"



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:operation>



</mx:WebService>











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












0 Replies