3 Replies Latest reply on Mar 3, 2010 9:47 PM by Flex harUI

    Any Expert can help me? ArrayCollection as WebService Input doesn't Work

    Gene Qian

      I published a java webservice method: Product[] getProductByCondition(Condition[] conds). In flex, when I click a button which take a datagrid dataprovider which is actually a ArrayCollection of Condition value object. The problem is the back-end java service always tells the conds argument is null and throw a null Exception error. part of the code goes here:


      Flex Code of the Condition AS class:


      public class Condition

         public var field:String;
         public var op:String;
         public var value:String;


         public function Condition() {};



      Flex Code of the button click event:


      // each item of dataProvider is a Condition value object. the dataProvider is not null in Flex side

      executeQueryResult.token = productWS.getProductByCondition(myConditionDataGrid.dataProvider as ArrayCollection);


      java code of the back-end Condition class:


      public class Condition implements java.io.Serializable
          private String field

          private String op;
          private String value; 

          public Condition() {}


           public String getField() {  return this.field; }




      java code of the back-end web service method:


      public Product[] getProductByCondition(Condition[] conds)
        return productOperation.getProductByCondition(conds);


      the problem is the argument conds is always null in java side. Anyone can advise? Thanks. I am using Flash Builder 4. (Beta version)


      I ever tried to transform the dataProvider ArrayCollection to Array object in Flex as WS argument, but the compiler always tells error: Implicit coercion of a value of type Array to an unrelated type mx.collections.ArrayCollection