2 Replies Latest reply on Oct 13, 2009 9:33 AM by TanweerHq

    Why my Web service why it doesn't work

    BastiaanWilderom

      Hy folks I am a newbie in Flex

       

      I created a web service in ASP.NET for retrieving data from de Northwind file ins an SQL server.

       

      It works well

       

      After that I created the following Flex application using the wbe service to obtain the data from the web service

      and show it in a data grip, but it doesn't work. No data appears in my grid.

       

      What is the problem Whi is it not working ?

       

       

       

       

      <mx:WebService

       

       

      id="Mydados" wsdl="http://localhost:1456/Service1.asmx?wsdl"

      >

       

       

      <mx:operation name="customerList"/>

       

       

      </mx:WebService>

       

       

       

      <mx:DataGrid x="147" y="158" dataProvider="{Mydados.customerList.lastResult}"

      >

       

       

      <mx:columns>

       

       

      <mx:DataGridColumn headerText="Clientes" dataField="CustomerID"

      />

       

       

      <mx:DataGridColumn headerText="empresa" dataField="CompanyName"

      />

       

       

      <mx:DataGridColumn headerText="nome contato" dataField="ContactName"

      />

       

       

      </mx:columns>

       

       

      </mx:DataGrid>

       

      Thanks in advance

        • 1. Re: Why my Web service why it doesn't work
          Subeesh Arakkan Level 4

          Register event listeners for result and fault. In the resulthandler function check the format of the data you are getting back from server and then set the datagrid dataprovider with the correct data.

          • 2. Re: Why my Web service why it doesn't work
            TanweerHq Level 2

            Best practice while using Dataservices is ..

            1. Call the webservice(webServiceID.method('parameters if any')) in the page event(init or cc ....etc)

            2. Handle the result event by calling a method in the result of webservice tag. Take the result in to an arraycollection

            3. chck the count of arraycollection

            4. if arraycollectioncount > 0

             

            set the datagrid.dataprovider = arraycollection or u can also bind the collection at design time

             

            5. also declare the fault event to check if any errors in the operation