Well I have narrowed it down, it wasn't any of the collections stuff
as I previously thought.
It appears to be a public static final variable that I had defined
in my class.
class x {
...
public static final String TEST_KEY = "test";
...
}
With the above class I can retrieve it from the server and its fine
in flex but if I send that same instance back, I get the error about
the type being flashgateway.io.ASObject but it was expecting type X.
Is there a way around this, or do my objects just need to avoid
having these?
Thanks for the responses so far.
--- In [email protected], "Peter Farland" <[EMAIL PROTECTED]>
wrote:
>
> This may be a long shot, but another issue to consider is whether
> Object.registerClass was called before any instances of that type
were
> received from the server. Can you try creating a new dummy
instance of
> the testuser.Test type on the client _before_ making the
RemoteObject
> call?
>
> Are you using the "/WEB-INF/flex/gateway-config.xml logging level
Debug"
> method to trace server logging, or relying on a client debugging
tool?
>
>
>
>
> -----Original Message-----
> From: [email protected]
[mailto:[EMAIL PROTECTED] On
> Behalf Of jgraham_us
> Sent: Thursday, December 15, 2005 3:20 PM
> To: [email protected]
> Subject: [flexcoders] Re: passing Map from Flex to server side
>
> public static var regClass =
> Object.registerClass("testuser.Test", views.testuser.Test);
>
> Thats the actual line. I just made a mistake when typing in the
psuedo
> code below.
>
> The weird part is, if I build the Object on the client side and
send it
> across to the server it appears to work.
>
> I can look at the objects in the debugger and compare them and I
can't
> see any difference between them.
>
> Is there a way to figure out more details as to which object it is
> failing on when sending back to the server?
>
> The error message is not very detailed, I get two different errors
on
> the client side.
>
> One is an error about converting the input type, and the other is
it was
> expecting type testuser.Test but was trying to send
> flashgateway.io.ASObject.
>
> Thanks
>
> --- In [email protected], "Peter Farland" <[EMAIL PROTECTED]>
> wrote:
> >
> > Can you double check your usage of Object.registerClass?
> >
> > Object.registerClass("testuser.Test","Test");
> >
> > Should be
> >
> > Object.registerClass("testuser.Test", Test);
> >
> >
> > -----Original Message-----
> > From: [email protected]
> [mailto:[EMAIL PROTECTED] On
> > Behalf Of jgraham_us
> > Sent: Thursday, December 15, 2005 2:25 PM
> > To: [email protected]
> > Subject: [flexcoders] Re: passing Map from Flex to server side
> >
> > Going from server to client appears to be working fine. My
server
> > classes do not implement Map or Collection. I have tried very
> simple
> > cases, and the Maps are not empty.
> >
> > Here is an example.
> >
> > Test.java
> > ------------------------------------------------------
> > package testuser;
> >
> > public class Test{
> >
> > Map<String, User> users;
> >
> > Map<String, User> getUsers() {
> > ...
> > }
> >
> > void setUsers(Map<String, Users> users) {
> > ...
> > }
> >
> > }
> > -------------------------------------------------------
> >
> > Test.as
> > -------------------------------------------------------
> > class Test
> > {
> > Object.registerClass("testuser.Test","Test");
> >
> > var users : Array;
> >
> > ...
> > }
> >
> > So are you saying that my object on the server side, users must
be
> of
> > type ASObject, or do I have to implement some intermediate type
> then
> > build my server side Test object from this intermediate type that
> is an
> > ASObject?
> >
> > Basically I need to get the Test object on the client side
possibly
> > update it and then send that same object back and have it be a
Test
> > (server side object) when I get it back on the server.
> >
> > Thanks
> > --- In [email protected], "Peter Farland"
<[EMAIL PROTECTED]>
> > wrote:
> > >
> > >
> > > Note that while you can register classes using ActionScript on
> the
> > > client for serialization... there's no way to "register" a Java
> > class on
> > > the server. Your server type must not implement Map or
Collection
> > as
> > > these types already have firm rules for server to client
> > serialization.
> > >
> > > This may be something to log for consideration for Flex 2.0.
> > >
> > >
> > > Alternatively, any chance are you returning empty Maps in any
of
> > the
> > > properties?
> > >
> > > I ask because the following special case may occur:
> > >
> > > Empty Java Map -> Empty AS Associative Array -> Empty Java List
> > >
> > > This is because there's no distinction between an empty dense,
> > ordinal,
> > > i.e. normal AS Array and an empty AS Associative Array (i.e.
> > they're the
> > > thing, just an empty Array) and thus Array -> List.
> > >
> > > I'd contact Flex Support if you need a solution to the latter
for
> > Flex
> > > 1.5. We've worked with customers on this problem.
> > >
> > > (NB: After several customer requests, Flex 1.5 reverted back to
> > match
> > > the legacy behavior from Flash Remoting's convention of
returning
> > a Java
> > > Map as an associative Array instead of an Object... which
> > historically
> > > stems from ColdFusionStructs being return as AS Associative
> Arrays
> > > (...and note Flex 1.0 had Maps returned as Objects).
> > >
> > > In Flex 2.0 we've again moved to have Java Maps returned as AS
> > Objects
> > > by default (with a configuration option for people who wish to
go
> > back
> > > to the old Arrays... but note this something that we would
> > discourage in
> > > Flex 2.0 due to the issue described above).
> > >
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: [email protected]
> > [mailto:[EMAIL PROTECTED] On
> > > Behalf Of jgraham_us
> > > Sent: Thursday, December 15, 2005 12:23 PM
> > > To: [email protected]
> > > Subject: [flexcoders] passing Map from Flex to server side
> > >
> > > Using remote objects stuff, I am able to pass my object which
> > contains a
> > > Map object from server to flex, but when I try to send that
> object
> > > back it doesn't work.
> > >
> > > Set objects work, but Map objects don't.
> > >
> > >
> > > On the AS side my Map is defined as an Array in the AS object.
> > >
> > > On the server side it is a Map object.
> > >
> > > I have a registerClass call to map the AS object to the java
> > object.
> > >
> > > Can anyone help me out or point me to any examples of how to do
> > this?
> > >
> > > Thanks
> > >
> > >
> > >
> > >
> > >
> > >
> > > ------------------------ Yahoo! Groups Sponsor ----------------
--
> --
> > ~-->
> > > Most low income homes are not online. Make a difference this
> > holiday
> > > season!
> > > http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/nhFolB/TM
> > > ---------------------------------------------------------------
--
> --
> > -~->
> > >
> > > --
> > > Flexcoders Mailing List
> > > FAQ:
> > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > > Search Archives:
> > > http://www.mail-archive.com/flexcoders%40yahoogroups.com
> > > Yahoo! Groups Links
> > >
> >
> >
> >
> >
> >
> >
> > ------------------------ Yahoo! Groups Sponsor ------------------
--
> ~-->
> > 1.2 million kids a year are victims of human trafficking. Stop
> slavery.
> > http://us.click.yahoo.com/.QUssC/izNLAA/TtwFAA/nhFolB/TM
> > -----------------------------------------------------------------
--
> -~->
> >
> > --
> > Flexcoders Mailing List
> > FAQ:
> http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
> > http://www.mail-archive.com/flexcoders%40yahoogroups.com
> > Yahoo! Groups Links
> >
>
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------
~-->
> Get Bzzzy! (real tools to help you find a job). Welcome to the
Sweet
> Life.
> http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/nhFolB/TM
> -------------------------------------------------------------------
-~->
>
> --
> Flexcoders Mailing List
> FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income homes are not online. Make a difference this holiday season!
http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/