The ObjectProxy is returned when the player de-serializes a server side
class which it does not recognize.  (It would ordinarily return just an
Object, but that is wrapped by an ObjectProxy if you have the
makeObjectsBindable property set since plain old Object does not support
binding events).  

 

There are a couple of reasons why this might be the case... Most likely
your server side object's class may not match exactly "com.foo.Expr" -
it could be a sub-class.   To see what is being put on the wire, you can
enable server side debug logging.  If you are using FDS, you do this in
services-config.xml, set level="Debug" and make sure the "Endpoint.*"
target is in there.  You can see the trace of the AMF server debug logs
to see what class name is being put onto the wire. 

 

The other thing that can cause this is if your class alias is not
getting registered on the client somehow.  Your RemoteClass tag should
take care of that as long as that class gets linked into your SWF (which
should be happening as you have a reference to that class).  You can
diagnose that using the "describeType" method  on the client side and
look for the alias which is in that mapping. 

 

Jeff

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of moonusamy
Sent: Thursday, March 01, 2007 9:32 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Invoking RemoteObject method - Type Coercion error

 


I'm using RemoteObject to invoke a server-side Java POJO method that
returns an object of type com.foo.Expr. I have Expr.java and Expr.as
with Expr.as annotated with [Bindable] and
[RemoteClass(alias="com.foo.Expr")]

I try to reference the returned value in the result handler in my mxml
as follows:
private function fooResultHandler(event:ResultEvent):void
{
myexpr = Expr(event.result); 

TypeError: Error #1034: Type Coercion failed: cannot convert
mx.utils::[EMAIL PROTECTED] to com.foo.Expr

I expect event.result to be of type com.foo.Expr which it doesn't seem
to be. What do I need to do to get to the object of type Expr that my
method invocation returns?

Thanks
Vijay

 

Reply via email to