15 Replies Latest reply on Jun 24, 2008 12:42 AM by (Russell_C_Taylor)

    BlazeDS FlashDevelop RPC ArrayList

    Level 1
      Hi,<br /><br />I've managed to get RPC working with BlazeDS and FlashDevelop using pure actionscript 3 & rpc.swc.  Great, I can return strings & booleans from the my java objects.<br /><br />I've tried some tutes and the BlazeDS developers guide to try and create custom serialization.  But I am stuck with - ArgumentError: Error #2004: One of the parameters is invalid.  When I try to return an ArrayList?<br /><br />The developers guide says it's possible to associate the java ArrayList with mx.collections.ArrayCollection.  I've tried several methods but so far just get the above error.  <br /><br />Here's the ArrayList<IdeaRO> that I'm trying to serialize;<br /><br />package tbi.DAO;<br /><br />//import java.util.Vector;<br />import java.io.Externalizable;<br />import java.io.IOException;<br />import java.io.ObjectInput;<br />import java.io.ObjectOutput;<br /><br />/**<br /> * <br /> * @author Russell Taylor<br /> * @created 13.06.2008<br /> * <br /> * This result object contains relates to each Idea Touch Point<br /> * and can also be used the Ideas in the related scroll component<br /> *<br /> */<br />public class IdeaRO implements Externalizable {<br />     <br />     private int _id;<br />     private String _title;<br />     private String _imageUrl;<br />     private int _level;<br />     private int _plusScore;<br />     private int _minusScore;<br />     <br />     /**<br />      * BlazeDS needs this to instantiate<br />      */<br />     public IdeaRO(){<br />          <br />     }<br />     <br />     public int getId(){<br />          return _id;<br />     }<br />     <br />     public void setId(int value){<br />          this._id = value;<br />     }<br />     <br />     public String getTitle(){<br />          return _title;<br />     }<br />     <br />     public void setTitle(String value){<br />          this._title = value;<br />     }<br />     <br />     public String getImageURL(){<br />          return _imageUrl;<br />     }<br />     <br />     public void setImageURL(String value){<br />          this._imageUrl = value;<br />     }<br />     <br />     public int getLevel(){<br />          return _level;<br />     }<br />     <br />     public void setLevel(int value){<br />          this._level = value;<br />     }<br />     <br />     public int getPlusScore(){<br />          return _plusScore;<br />     }<br />     <br />     public void setPlusScore(int value){<br />          this._plusScore = value;<br />     }<br />     <br />     public int getMinusScore(){<br />          return _minusScore;<br />     }<br />     <br />     public void setMinusScore(int value){<br />          this._minusScore = value;<br />     }<br />     <br />     /**<br />     * Serializes the server state of an instance of ThirdPartyProxy<br />     * by sending a String for the name, a Map of properties<br />     * String for the description, and a floating point<br />     * integer (single precision) for the price. Notice that the inventory <br />     * identifier is not sent to external clients.<br />     */<br />    public void writeExternal(ObjectOutput out) throws IOException {<br />        // Write out the client properties from the server representation<br />        out.writeFloat(_id);<br />        out.writeObject(_title);<br />        out.writeObject(_imageUrl);<br />        out.writeFloat(_level);<br />        out.writeFloat(_minusScore);<br />        out.writeFloat(_plusScore);<br />    }<br />    <br />    /**<br />     * Deserializes the client state of an instance of ThirdPartyProxy<br />     * by reading in String for the name, a Map of properties<br />     * for the description, and <br />     * a floating point integer (single precision) for the price. <br />     */<br />    public void readExternal(ObjectInput in) throws IOException,<br />        ClassNotFoundException {<br />        // Read in the server properties from the client representation.<br />        _id = (int)in.readFloat();<br />        _title = (String)in.readObject();<br />        _imageUrl = (String)in.readObject();<br />        _level = (int)in.readFloat();<br />        _minusScore = (int)in.readFloat();<br />        _plusScore = (int)in.readFloat();<br />        <br />    }<br /><br />}<br /><br />Any help would be appreciated.<br /><br />Thanks,<br /><br />Russell
        • 1. Re: BlazeDS FlashDevelop RPC ArrayList
          Peter Farland Level 3
          Make sure mx.collections.ArrayList is linked into your SWF so that it is
          available at runtime. You just need to import this class and make a
          reference to it somewhere so that it gets compiled into the SWF.
          • 2. Re: BlazeDS FlashDevelop RPC ArrayList
            Level 1
            Thanks for the quick response :)<br /><br />I have mx.collection.ArrayList included (Flex 2 source framwork globalpath).  But I think I'm missing a trick.  I've read that LCDS has problems serializing a custom ArrayList and returns null?  My ArrayList is in java is a standard arraylist of custom objects. ie. ArrayList<IdeaRO>.<br /><br />Here's my test connection class in case I'm doing something wrong;<br /><br />package dao <br />{<br />     import flash.net.NetConnection;<br />     import flash.net.Responder;<br />     import flash.net.ObjectEncoding;<br />     import flash.events.*;<br />     import flash.text.*;<br />     import flash.display.*;<br />     import xml.XMLProxyModel;<br />     import mx.collections.ArrayList;<br />     import dao.IdeaRO;<br />     <br />     /**<br />     * ...<br />     * @author Russell Taylor<br />     */<br />     public class ConnectionHelper extends Sprite<br />     {<br />          private var gateway:String = XMLProxyModel.getInstance().amfChannel;<br />          private var con:NetConnection;<br />          private var responder:Responder;<br />          private var tf:TextField;<br />          <br />          public function ConnectionHelper() <br />          {<br />               <br />               responder = new Responder(onResult, onFault);<br />               <br />               con = new NetConnection();<br />               NetConnection.defaultObjectEncoding = ObjectEncoding.AMF3;<br />               <br />               con.addEventListener(NetStatusEvent.NET_STATUS, onStatus);<br />               con.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);<br />               <br />               con.connect(gateway);<br /><br />               <br />               con.call("tbi.getSphinxArray", responder);<br /><br />          }<br />          <br />          private function onStatus(event:NetStatusEvent = null):void<br />          {<br />               traceField("NetStatus="+String(event.info.code));<br />          }<br />          <br />          private function securityErrorHandler(event:SecurityErrorEvent = null):void<br />          {<br />               traceField("Security Error=" + event);<br />          }<br />          <br />          private function onResult(result:Object):void<br />          {<br />               var resultSet:ArrayList = ArrayList(result);<br />               traceField("Result=" + String(resultSet));<br /><br />          }<br />          <br />          private function onFault(fault:Object=null):void<br />          {<br />               traceField("Fault="+String(fault.message));<br />          }<br />          <br />          private function traceField(txt:String):void<br />          {<br />               if(tf == null){<br />               tf = new TextField();<br />               tf.background = true;<br />               tf.backgroundColor = 0xFFFFFF;<br />               tf.width = 500;<br />               tf.height = 500;<br />               addChild(tf);<br />               }<br />               tf.appendText(txt);<br />          }<br />          <br />     }<br />     <br />}<br /><br />Can anyone see any glaring mistakes?<br /><br />Thanks.
            • 3. Re: BlazeDS FlashDevelop RPC ArrayList
              Peter Farland Level 3
              Importing something is not enough, you need to make a reference to it by<br />using the type for a variable, method signature, whatever... e.g. try<br />adding a dummy variable:<br /> <br />private static var dep:IdeaRO;<br /><br />________________________________<br /><br />From: Russell C Taylor [mailto:member@adobeforums.com] <br />Sent: Monday, June 23, 2008 9:33 AM<br />To: blazeds-gettingstarted@adobeforums.com<br />Subject: Re: BlazeDS FlashDevelop RPC ArrayList<br /><br /><br />A new message was posted by Russell C Taylor in <br /><br />Configuration and Getting Started Discussion --<br />  BlazeDS FlashDevelop RPC ArrayList<br /><br />Thanks for the quick response :) <br /><br />I have mx.collection.ArrayList included (Flex 2 source framwork<br />globalpath). But I think I'm missing a trick. I've read that LCDS has<br />problems serializing a custom ArrayList and returns null? My ArrayList<br />is in java is a standard arraylist of custom objects. ie.<br />ArrayList<IdeaRO>. <br /><br />Here's my test connection class in case I'm doing something wrong; <br /><br />package dao <br />{ <br />import flash.net.NetConnection; <br />import flash.net.Responder; <br />import flash.net.ObjectEncoding; <br />import flash.events.*; <br />import flash.text.*; <br />import flash.display.*; <br />import xml.XMLProxyModel; <br />import mx.collections.ArrayList; <br />import dao.IdeaRO; <br /><br />/** <br />* ... <br />* @author Russell Taylor <br />*/ <br />public class ConnectionHelper extends Sprite <br />{ <br />private var gateway:String = XMLProxyModel.getInstance().amfChannel; <br />private var con:NetConnection; <br />private var responder:Responder; <br />private var tf:TextField; <br /><br />public function ConnectionHelper() <br />{ <br /><br />responder = new Responder(onResult, onFault); <br /><br />con = new NetConnection(); <br />NetConnection.defaultObjectEncoding = ObjectEncoding.AMF3; <br /><br />con.addEventListener(NetStatusEvent.NET_STATUS, onStatus); <br />con.addEventListener(SecurityErrorEvent.SECURITY_ERROR,<br />securityErrorHandler); <br /><br />con.connect(gateway); <br /><br /><br /><br />con.call("tbi.getSphinxArray", responder); <br /><br />} <br /><br />private function onStatus(event:NetStatusEvent = null):void <br />{ <br />traceField("NetStatus="+String(event.info.code)); <br />} <br /><br />private function securityErrorHandler(event:SecurityErrorEvent =<br />null):void <br />{ <br />traceField("Security Error=" + event); <br />} <br /><br />private function onResult(result:Object):void <br />{ <br />var resultSet:ArrayList = ArrayList(result); <br />traceField("Result=" + String(resultSet)); <br /><br />} <br /><br />private function onFault(fault:Object=null):void <br />{ <br />traceField("Fault="+String(fault.message)); <br />} <br /><br />private function traceField(txt:String):void <br />{ <br />if(tf == null){ <br />tf = new TextField(); <br />tf.background = true; <br />tf.backgroundColor = 0xFFFFFF; <br />tf.width = 500; <br />tf.height = 500; <br />addChild(tf); <br />} <br />tf.appendText(txt); <br />} <br /><br />} <br /><br />} <br /><br />Can anyone see any glaring mistakes? <br /><br />Thanks. <br /><br /><br />________________________________<br /><br />View/reply at BlazeDS FlashDevelop RPC ArrayList<br /><a href=http://www.adobeforums.com/webx?13@@.59b59dad/1> <br />Replies by email are OK.<br />Use the unsubscribe<br /><a href=http://www.adobeforums.com/webx?280@@.59b59dad!folder=.3c061a84>  form<br />to cancel your email subscription.
              • 4. Re: BlazeDS FlashDevelop RPC ArrayList
                Level 1
                Thanks again Peter. I tried your suggestion but the application error is still there.

                I suspect it is related to BlazeDS inability to seriliaze my ArrayList. I have read the BlazeDS developers guide but I am stuck trying to correctly externalize an ArrayList in both Java and actionscript.

                Any examples would be appreciated:)

                Thanks again. So close yet so far!
                • 5. Re: BlazeDS FlashDevelop RPC ArrayList
                  Level 1
                  The reason for my thinking above is an unhandled argumenterror Error #2004 - One of the parameters is invalid. Which is thrown by the Flash 9 debugger.

                  I only get this problem with an ArrayList. I've tried other data types, all were successful.

                  Thanks in advance for even the smallest pin-***** at the end of the tunnel :)
                  • 6. Re: BlazeDS FlashDevelop RPC ArrayList
                    Level 1
                    Here's the method that creates the ArrayList I wish to parse to the client.<br /><br />/**<br />      *  Search results method parses the HashMap<br />      *  and returns a result list collection<br />      *  <br />      *  @param ids HashMap<String, int[]><br />      *  <br />      *  @return List collection of results<br />      */<br />     public static ArrayList<IdeaRO> getSphinxArray(HashMap<String, int[]> ids) throws SQLException{<br />          ArrayList<IdeaRO> list = new ArrayList<IdeaRO>();<br />          Connection c = null;<br />          <br />               try{<br />                    c = ConnectionHelper.getConnection();<br />                    Statement s = c.createStatement();<br />                    for (Iterator<Map.Entry<String, int[]>> entry=ids.entrySet().iterator(); entry.hasNext();){<br />                         Map.Entry<String, int[]> key = (Map.Entry<String, int[]>)entry.next();<br />                         for(int id:key.getValue()){<br />                              ResultSet rs = s.executeQuery("SELECT `tbi_db_test`.`post`.`title`, `tbi_db_test`.`link`.`url`, `tbi_db_test`.`levelindicator`.`level`, `tbi_db_test`.`scorerelation`.`score_plus`, `tbi_db_test`.`scorerelation`.`score_minus` FROM `tbi_db_test`.`post` JOIN tbi_db_test.link ON tbi_db_test.post.post_id=tbi_db_test.link.post_id_fk JOIN tbi_db_test.levelindicator ON tbi_db_test.post.post_id=tbi_db_test.levelindicator.post_id_fk JOIN tbi_db_test.scorerelation ON tbi_db_test.post.post_id=tbi_db_test.scorerelation.post_id_fk WHERE tbi_db_test.post.post_id="+(int)id);<br />                              while(rs.next()){<br />                                   IdeaRO result = new IdeaRO();<br />                                   result.setId((int)id);<br />                                   result.setTitle(rs.getString("title"));<br />                                   result.setImageURL(rs.getString("url"));<br />                                   result.setLevel(rs.getInt("level"));<br />                                   result.setPlusScore(rs.getInt("score_plus"));<br />                                   result.setMinusScore(rs.getInt("score_minus"));<br />                                   list.add(result);<br />                              }<br />                         }<br />                    }<br />               }finally{<br />                    c.close();<br />               }<br /><br />          return list;<br />     };
                    • 7. Re: BlazeDS FlashDevelop RPC ArrayList
                      Peter Farland Level 3
                      <DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff size=2>Oh sorry, I thought you were talking about <br />flex.messaging.io.ArrayList (Server) / mx.collections.ArrayList <br />(Client).</FONT></SPAN></DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff size=2></FONT></SPAN> </DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff size=2>You're just asking about the standard java.util.ArrayList <br />collection class. In that case, these are being returned as <br />flex.messaging.io.ArrayCollection instances by default, the equivalent for that <br />class on the client is mx.collections.ArrayCollection. </FONT></SPAN><SPAN <br />class=918365815-23062008><FONT face=Arial color=#0000ff size=2>So.... you would <br />need to ensure mx.collections.ArrayCollection is linked into your SWF in the <br />manner described earlier.</FONT></SPAN></DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff size=2></FONT></SPAN> </DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff size=2>Or.... you can change the BlazeDS endpoint <br />serialization setting "legacy-collection" to true to get it to return <br />ActionScript Arrays for Java Collections. See:</FONT></SPAN></DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff size=2></FONT></SPAN> </DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff size=2><A <br />href="http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=serialize_ data_3.html">http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=serial ize_data_3.html</A></FONT></SPAN></DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff size=2></FONT></SPAN> </DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff size=2>i.e.</FONT></SPAN></DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff size=2></FONT></SPAN> </DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff size=2>        <br />&lt;channel-definition id="my-amf" <br />class="mx.messaging.channels.AMFChannel"&gt;<BR>            <br />&lt;endpoint url="<A <br />href="http://{server.name}:{server.port}/{context.root}/messagebroker/amf">http://{serv er.name}:{server.port}/{context.root}/messagebroker/amf</A>" <br />class="flex.messaging.endpoints.AMFEndpoint"/&gt;<BR>            <br />&lt;properties&gt;<BR>                <br />&lt;polling-enabled&gt;false&lt;/polling-enabled&gt;</FONT></SPAN></DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff <br />size=2>                &lt;serialization&gt;</FONT></SPAN></DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff <br />size=2>                    <br />&lt;legacy-collection&gt;true&lt;/legacy-collection&gt;</FONT></SPAN></DIV><br /><DIV dir=ltr align=left><SPAN class=918365815-23062008><FONT face=Arial <br />color=#0000ff <br />size=2>                <br />&lt;/serialization&gt;<BR>            <br />&lt;/properties&gt;<BR>        <br />&lt;/channel-definition&gt;<BR></DIV></FONT></SPAN><BR><br /><DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><br /><HR tabIndex=-1><br /><FONT face=Tahoma size=2><B>From:</B> Russell C Taylor <br />[mailto:member@adobeforums.com] <BR><B>Sent:</B> Monday, June 23, 2008 11:38 <br />AM<BR><B>To:</B> blazeds-gettingstarted@adobeforums.com<BR><B>Subject:</B> Re: <br />BlazeDS FlashDevelop RPC ArrayList<BR></FONT><BR></DIV><br /><DIV></DIV>A new message was posted by Russell C Taylor in <br /><BR><BR><B>Configuration and Getting Started Discussion</B> <br />--<BR>  BlazeDS FlashDevelop RPC ArrayList<BR><BR>Here's the method <br />that creates the ArrayList I wish to parse to the client. <BR><BR>/** <BR>* <br />Search results method parses the HashMap <BR>* and returns a result list <br />collection <BR>* <BR>* @param ids HashMap&lt;String, int[]&gt; <BR>* <BR>* <br />@return List collection of results <BR>*/ <BR>public static <br />ArrayList&lt;IdeaRO&gt; getSphinxArray(HashMap&lt;String, int[]&gt; ids) throws <br />SQLException{ <BR>ArrayList&lt;IdeaRO&gt; list = new ArrayList&lt;IdeaRO&gt;(); <br /><BR>Connection c = null; <BR><BR>try{ <BR>c = ConnectionHelper.getConnection(); <br /><BR>Statement s = c.createStatement(); <BR>for (Iterator&lt;Map.Entry&lt;String, <br />int[]&gt;&gt; entry=ids.entrySet().iterator(); entry.hasNext();){ <br /><BR>Map.Entry&lt;String, int[]&gt; key = (Map.Entry&lt;String, <br />int[]&gt;)entry.next(); <BR>for(int id:key.getValue()){ <BR>ResultSet rs = <br />s.executeQuery("SELECT `tbi_db_test`.`post`.`title`, `tbi_db_test`.`link`.`url`, <br />`tbi_db_test`.`levelindicator`.`level`, <br />`tbi_db_test`.`scorerelation`.`score_plus`, <br />`tbi_db_test`.`scorerelation`.`score_minus` FROM `tbi_db_test`.`post` JOIN <br />tbi_db_test.link ON tbi_db_test.post.post_id=tbi_db_test.link.post_id_fk JOIN <br />tbi_db_test.levelindicator ON <br />tbi_db_test.post.post_id=tbi_db_test.levelindicator.post_id_fk JOIN <br />tbi_db_test.scorerelation ON <br />tbi_db_test.post.post_id=tbi_db_test.scorerelation.post_id_fk WHERE <br />tbi_db_test.post.post_id="+(int)id); <BR>while(rs.next()){ <BR>IdeaRO result = <br />new IdeaRO(); <BR>result.setId((int)id); <br /><BR>result.setTitle(rs.getString("title")); <br /><BR>result.setImageURL(rs.getString("url")); <br /><BR>result.setLevel(rs.getInt("level")); <br /><BR>result.setPlusScore(rs.getInt("score_plus")); <br /><BR>result.setMinusScore(rs.getInt("score_minus")); <BR>list.add(result); <BR>} <br /><BR>} <BR>} <BR>}finally{ <BR>c.close(); <BR>} <BR><BR>return list; <BR>}; <br /><BR><BR><br /><HR align=left width=200><br />View/reply at <A href="http://www.adobeforums.com/webx?13@@.59b59dad/5">BlazeDS <br />FlashDevelop RPC ArrayList</A><BR>Replies by email are OK.<BR>Use the <A <br />href="http://www.adobeforums.com/webx?280@@.59b59dad!folder=.3c061a84">unsubscribe</A> <br />form to cancel your email subscription.<BR><BR>
                      • 8. Re: BlazeDS FlashDevelop RPC ArrayList
                        Peter Farland Level 3
                        (Resending in plain text)...<br /><br /><br />Oh sorry, I thought you were talking about flex.messaging.io.ArrayList<br />(Server) / mx.collections.ArrayList (Client).<br /> <br />You're just asking about the standard java.util.ArrayList collection<br />class. In that case, these are being returned as<br />flex.messaging.io.ArrayCollection instances by default, the equivalent<br />for that class on the client is mx.collections.ArrayCollection. So....<br />you would need to ensure mx.collections.ArrayCollection is linked into<br />your SWF in the manner described earlier.<br /> <br />Or.... you can change the BlazeDS endpoint serialization setting<br />"legacy-collection" to true to get it to return ActionScript Arrays for<br />Java Collections. See:<br /> <br />http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=s<br />erialize_data_3.html<br /> <br />i.e.<br /> <br />        <channel-definition id="my-amf"<br />class="mx.messaging.channels.AMFChannel"><br />            <endpoint<br />url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf<br />" class="flex.messaging.endpoints.AMFEndpoint"/><br />            <properties><br />                <polling-enabled>false</polling-enabled><br />                <serialization><br />                    <legacy-collection>true</legacy-collection><br />                </serialization><br />            </properties><br />        </channel-definition><br /><br /><br /><br /><br />------------------------------------------------------------------------<br />--------<br />From: Russell C Taylor [mailto:member@adobeforums.com] <br />Sent: Monday, June 23, 2008 11:38 AM<br />To: blazeds-gettingstarted@adobeforums.com<br />Subject: Re: BlazeDS FlashDevelop RPC ArrayList<br /><br /><br />A new message was posted by Russell C Taylor in <br /><br />Configuration and Getting Started Discussion --<br />  BlazeDS FlashDevelop RPC ArrayList<br /><br />Here's the method that creates the ArrayList I wish to parse to the<br />client. <br /><br />/** <br />* Search results method parses the HashMap <br />* and returns a result list collection <br />* <br />* @param ids HashMap<String, int[]> <br />* <br />* @return List collection of results <br />*/ <br />public static ArrayList<IdeaRO> getSphinxArray(HashMap<String, int[]><br />ids) throws SQLException{ <br />ArrayList<IdeaRO> list = new ArrayList<IdeaRO>(); <br />Connection c = null; <br /><br />try{ <br />c = ConnectionHelper.getConnection(); <br />Statement s = c.createStatement(); <br />for (Iterator<Map.Entry<String, int[]>> entry=ids.entrySet().iterator();<br />entry.hasNext();){ <br />Map.Entry<String, int[]> key = (Map.Entry<String, int[]>)entry.next(); <br />for(int id:key.getValue()){ <br />ResultSet rs = s.executeQuery("SELECT `tbi_db_test`.`post`.`title`,<br />`tbi_db_test`.`link`.`url`, `tbi_db_test`.`levelindicator`.`level`,<br />`tbi_db_test`.`scorerelation`.`score_plus`,<br />`tbi_db_test`.`scorerelation`.`score_minus` FROM `tbi_db_test`.`post`<br />JOIN tbi_db_test.link ON<br />tbi_db_test.post.post_id=tbi_db_test.link.post_id_fk JOIN<br />tbi_db_test.levelindicator ON<br />tbi_db_test.post.post_id=tbi_db_test.levelindicator.post_id_fk JOIN<br />tbi_db_test.scorerelation ON<br />tbi_db_test.post.post_id=tbi_db_test.scorerelation.post_id_fk WHERE<br />tbi_db_test.post.post_id="+(int)id); <br />while(rs.next()){ <br />IdeaRO result = new IdeaRO(); <br />result.setId((int)id); <br />result.setTitle(rs.getString("title")); <br />result.setImageURL(rs.getString("url")); <br />result.setLevel(rs.getInt("level")); <br />result.setPlusScore(rs.getInt("score_plus")); <br />result.setMinusScore(rs.getInt("score_minus")); <br />list.add(result); <br />} <br />} <br />} <br />}finally{ <br />c.close(); <br />} <br /><br />return list; <br />}; <br /><br /><br />------------------------------------------------------------------------<br />--------<br />View/reply at BlazeDS FlashDevelop RPC ArrayList<br />Replies by email are OK.<br />Use the unsubscribe form to cancel your email subscription.
                        • 9. Re: BlazeDS FlashDevelop RPC ArrayList
                          Level 1
                          I had already set the legacy to true in the service-config.xml file.<br /><br />Does it make a difference if I am not compiling the service-config.xml with the SWF (only deployed in web-inf/flex on the server)?<br /><br />And I originally had ArrayCollections rather than ArrayList after reading the article before my first post.  So it's back to square one, because I still have the same error.<br /><br />ArgumentError: Error #2004: One of the parameters is invalid.<br /><br />Also, after I hit <continue> the result set then returns null.<br /><br />This post highlights my problem;<br /><br />http://iamjosh.wordpress.com/2007/12/12/serialization-of-custom-collections-for-flex-da ta-services/
                          • 10. Re: BlazeDS FlashDevelop RPC ArrayList
                            Level 1
                            Just found this in BlazeDS log file;<br /><br />flex.messaging.config.ConfigurationException: Unexpected child element 'legacy-collection' found in 'channel-definition' from file: services-config.xml.<br /><br />here's my service-config;<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /><services-config><br /><br />    <services><br />        <service-include file-path="remoting-config.xml" /><br />        <service-include file-path="proxy-config.xml" /><br />        <service-include file-path="messaging-config.xml" />        <br />    </services><br /><br />    <security><br />        <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/><br />        <!-- Uncomment the correct app server<br />        <login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss"><br />          <login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>        <br />        <login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/><br />        <login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/><br />        --><br /><br />        <!-- <br />        <security-constraint id="basic-read-access"><br />            <auth-method>Basic</auth-method><br />            <roles><br />                <role>guests</role><br />                <role>accountants</role><br />                <role>employees</role><br />                <role>managers</role><br />            </roles><br />        </security-constraint><br />         --><br />    </security><br /><br />    <channels><br /><br />        <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"><br />            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>     <br />          <properties><br />                <polling-enabled>false</polling-enabled>                 <br />               <serialization>                     <br />                    <legacy-collection>true</legacy-collection>                <br />               </serialization><br />            </properties>     <br />        </channel-definition><br /><br />        <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel"><br />            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/><br />            <properties><br />                <polling-enabled>true</polling-enabled><br />                <polling-interval-seconds>4</polling-interval-seconds><br />          <serialization>                     <br />               <legacy-collection>true</legacy-collection>                <br />          </serialization><br />            </properties><br />        </channel-definition><br /><br />    </channels><br /><br />    <logging><br />        <target class="flex.messaging.log.ConsoleTarget" level="Error"><br />            <properties><br />                <prefix>[BlazeDS] </prefix><br />                <includeDate>true</includeDate><br />                <includeTime>true</includeTime><br />                <includeLevel>true</includeLevel><br />                <includeCategory>true</includeCategory><br />            </properties><br />            <filters><br />                <pattern>Endpoint.*</pattern><br />                <pattern>Service.*</pattern><br />                <pattern>Configuration</pattern><br />            </filters><br />        </target><br />    </logging><br /><br />    <system><br />        <redeploy><br />            <enabled>true</enabled><br /><br />            <watch-interval>20</watch-interval><br />            <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file><br /><br />            <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file><br /><br />            <touch-file>{context.root}/WEB-INF/web.xml</touch-file><br />   <br />        </redeploy><br />    </system><br /><br /></services-config>
                            • 11. Re: BlazeDS FlashDevelop RPC ArrayList
                              Level 1
                              Ignore my last post. The error message was old.

                              I'm also using the latest BlazeDS BETA 3.0.2?
                              • 12. Re: BlazeDS FlashDevelop RPC ArrayList
                                Level 1
                                I switched logging to All and the log output from BlazeDS is a little strange.

                                Two ArrayList are output for each transaction. The first is correct for example;

                                [69] = tbi.DAO.IdeaRO
                                id = 260
                                title = MSDN Webcast: Unified Communications 101
                                minusScore = 1
                                level = 1
                                plusScore = 1
                                imageURL = test

                                This maps correctly to IdeaRO, but the second has no (int);

                                [69] = (Externalizable Object #70 'tbi.DAO.IdeaRO')
                                "MSDN Webcast: Unified Communications 101"
                                "test"

                                Where have the integers gone?

                                Thanks for your patience.
                                • 13. Re: BlazeDS FlashDevelop RPC ArrayList
                                  Level 1
                                  I've removed the Externalizable implementation and I have a mutli-dimensional array returned. Wahoo!
                                  • 14. Re: BlazeDS FlashDevelop RPC ArrayList
                                    Peter Farland Level 3
                                    It seems non-AMF 3 focused write methods don't trace debug output (they
                                    just delegate to the standard Java implementation from
                                    java.io.DataOutput).


                                    http://opensource.adobe.com/svn/opensource/blazeds/branches/3.0.x/module
                                    s/core/src/java/flex/messaging/io/amf/AbstractAmfOutput.java
                                    • 15. Re: BlazeDS FlashDevelop RPC ArrayList
                                      Level 1
                                      Thanks for that link Peter,

                                      I was using writeFloat to externalize integers in the DataOuput, I think I found this an a dev guide example. The link suggests I should have been using writeInt?

                                      My quest to serialize custom objects continues, but at least the app is working (if not efficiently). The biggest triumph was successfully using the low-level NetConnection framework with pure actionscript and the Flex SDK to remote with BlazeDS. Creating a blazing fast app with completely open-source products. Keep up the good work!