« Return to Thread: ArrayCollection items deserializing as type Object

Re: ArrayCollection items deserializing as type Object

by Support-179 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi Azeem,
 
Important is to have your classes referenced somewhere in your application so the compiler will pick them up.
In that case you can use the [RemoteClass(alias=".NET type name")] metadata tag without calling registerClassAlias
As last resort a "registerClassAlias" will ensure that your class is compiled (as you are referencing the AS class in the registerClassAlias parameter)
 
Zoli


From: fluorine-bounces@... [mailto:fluorine-bounces@...] On Behalf Of Azeem Ahmed
Sent: Friday, April 10, 2009 2:16 AM
To: 'Fluorine Mailing List'
Subject: Re: [Fluorine] ArrayCollection items deserializing as type Object

Hello everyone,

 

This is a fairly newbie question. :)

 

I’ve been subscribed to this list for some time now and have recently started using fluorine for one of my projects. I think this project is wonderful and I can’t wait for v1.1. Recently, I ran into the issue discussed in this particular thread. Of course, without this thread, I would have been lost. :)

 

Having said that, I’ve several ‘value objects’ in flex and the corresponding custom objects on the .net side. However, because of the issue described below, every time I add a new object, I’ve to add a line of code in my creationComplete handler for the application to register the class alias (using registerClassAlias). That is rather cumbersome and is definitely prone to errors as others start maintaining the product (and even as I continue to add more and more classes – initially I was thinking using the RemoteClass meta tag would be sufficient but it looks like you have to call registerClassAlias). Anyway, I was looking for some guidance from the experts on this list on what they do for this scenario. Is there a way to automatically register all VO classes at start up of the application and by that I mean without having to code in the creationComplete handler? Please let me know and any guidance would be much appreciated.

 

Thanks! – Azeem

 

 

From: fluorine-bounces@... [mailto:fluorine-bounces@...] On Behalf Of Support
Sent: Tuesday, September 23, 2008 11:10 AM
To: 'Fluorine Mailing List'
Subject: Re: [Fluorine] ArrayCollection items deserializing as type Object

 

Hi Philip,

 

Glad to be able to help :))

 

Anyway when you check the log file for such cases you will notice the following traces (DEBUG level):

DEBUG FluorineFx.FluorineGateway - Begin AMF request

DEBUG FluorineFx.Messaging.MessageServer - Query endpoint .....

DEBUG FluorineFx.IO.AMFReader - Class definition flex.messaging.messages.RemotingMessage loaded <----- this is the first class definition for Flex RPC

After these lines you should see what types FluorineFx will deserialize. Everything that has no corresponding class mapped will be traced as "Class definition (untyped) loaded"

When you do not see a trace about the specific type then probably class mapping info was not sent from the client.

 

Zoli

 

 


From: fluorine-bounces@... [mailto:fluorine-bounces@...] On Behalf Of Philip McKeown
Sent: Tuesday, September 23, 2008 3:26 PM
To: 'Fluorine Mailing List'
Subject: Re: [Fluorine] ArrayCollection items deserializing as type Object

Ah, it’s typical that you find the solution after you’ve posted the question!

 

I’ve discovered that the problem was that using the “private static const” to register the class alias worked most of the time because the Class object had been referenced somehow before the call was made. In this case, the alias didn’t get registered until after the server request was made, and so, the Flash runtime didn’t know how to map the response object.

 

After moving this line of code to another location, the deserialization worked fine!

 

Thanks for listening!! ;-)

 

Philip McKeown

 

From: fluorine-bounces@... [mailto:fluorine-bounces@...] On Behalf Of Philip McKeown
Sent: 23 September 2008 11:17
To: fluorine@...
Subject: [Fluorine] ArrayCollection items deserializing as type Object

 

Hi All,

 

This is my first time posting, but I’ve looked through the online forum to try to find a similar issue, and couldn’t. This is probably a newbie issue, so hopefully someone has come across this before…

 

I have a .Net service which returns a custom complex object. This object has a number of generic List<> properties, which are lists of other custom objects.

 

In Flex I have a set of Value Objects to match each of the objects returned in the service response. Each Value Object contains a line of code to register the class alias, e.g.:

 

private static const ALIAS_REMOTE:* = registerClassAlias("ServerObjectName", ClientValueObject);

 

When the call to my service returns to the Flex Client, each object in the object graph gets deserialized to the correct type, except for one particular class which is contained in one of the ArrayCollections, and my problem is I can’t see why. The object is declared and registered the same as everything else, the client-side object code is generated and I’ve double-checked for typo’s. I’ve also tried registering the class mappings on the server.

 

There is nothing special, or different about this class (that I can see). I’ve also tried logging the server DEBUG events, which have not shown any issues. Is there anything else I can check or try?

 

Sorry if this sounds a bit confusing, I’m trying to keep the post short!

 

Thanks,

Philip McKeown

 

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.169 / Virus Database: 270.7.1/1686 - Release Date: 9/23/2008 7:38 AM


_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com

 « Return to Thread: ArrayCollection items deserializing as type Object