The Object.registerClass looks correct - but, your Group object isn't as
simple as I thought. I imagine the Organization class also needs to be
registered and availabe on the Java side too. Is that class registered?
Does it have a public no args constructor? ... and so forth.


Note: While it is used to try and achieve a similar result, _remoteClass
isn't from the Object.registerClass (it's likely the server has added
this for the case where users have forgotten Object.registerClass and
the RemoteObject responder tries to create its own instance of the type
for you... this is much slower than if you had used Object.registerClass
as the player can do this natively for you much faster). _remoteClass
was introduced to support RemoteObject via SOAP in Flex 1.0. The SOAP
transport protocol was removed for RemoteObject in Flex 1.5. I'd like to
see all Flex users move away from _remoteClass and rely on
Object.registerClass.
 

-----Original Message-----
From: cazzaran [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 30, 2005 3:31 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Error: Cannot invoke method when using a VO



WHat's interesting, is if you look at the below code, I have an array
of Groups, called subGroups. This is populated with objects of the
type Group, so that would seem to mean that Flex is typing them
correctly, at least when they come FROM the server.... if I create a
new object of this type and send it TO my server, it seems to not be
correct.

What's also weird, is if I inspect an object using debug, all the
Groups in the subGroups array have _remoteClass set, even though I
didn't specify it. This is due to the Object.registerClass I assume,
but when I instantiate a new Group(), that object lacks this variable.
It seems like it's being typed wrong from the client side. Am I
interpreting this correctly?

Here's what my Group.as code looks like:

class pojos.Group {
   public static var regClass = Object.registerClass("pojos.Group",
pojos.Group);
  public var id:String;
  public var name:String;
  public var organization:Organization;
  public var superGroup:Group;
  public var subGroups:Array;

        function Group() {}

        public function get data() {
                return id;
        }
        
  //... some getters and business methods
}

--- In flexcoders@yahoogroups.com, "Peter Farland" <[EMAIL PROTECTED]>
wrote:
> Have you posted the Object.registerClass line of code in this thread
> yet? I've not yet seen it, but it must not be registered correctly or
> the class not linked in at compile time to match the registration as
the
> player would send an instance of Group.
> 
> All objects go over the wire as ASObjects, but they may include type
> information if they're registered.  The raw representation of an
> ASObject on the server side is a HashMap. It's the server side part of
> RemoteObject that knows how to map ASObject -> Group before invoking
> your method.
> 
> Since you're not having any luck with Flex Builder, did you try what I
> suggested using the NetConnectionDebugger.swf (which ships in the
extras
> folder of the Flex 1.5 install) with remote-objects debug enabled (it
> doesn't have anything to do with Flex Builder)? If that's not suitable
> then you could use the gateway debug level logging approach on the
> server. I'd prefer you to try the server gateway logging approach
anyway
> as we want to see whether an AMF Typed Object or untyped Object was
> deserialized from your Group param.
> 
> 
> -----Original Message-----
> From: cazzaran [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 30, 2005 2:12 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Error: Cannot invoke method when using a VO
> 
> 
> 
> I turned on remote object debugging, but it seems to make my
> flexbuilder unresponsive. After a while, builder says that I should
> abort the script or it will make my machine lock up. If I set remote
> object debug to false and restart the server, this no longer happens.
> 
> But I think I found the issue anyway; it seems that for some reason,
> the Group isn't being sent over the wire as a Group, even though I
> have the Object.registerClass correct. Also, when I get an array of
> Groups from my server, they are correct. 
> 
> But it seems that in my client class, when I do:
> 
> var group:Group = new Group();
> group.name = "test";
> remoteDelegate.addGroup(group);
> 
> it gives me that "can't invoke method error", because it's not a Group
> POJO, it's just a hashmap. Why is this happening?
> 
> 
> --- In flexcoders@yahoogroups.com, "Peter Farland" <[EMAIL PROTECTED]>
> wrote:
> > Have you managed to turn on debugging for remote-object in
> > /WEB-INF/flex/flex-config.xml and looked at the trace of the AMF
error
> > in the NetConnection Debugger? There may be more information on the
> > fault object in the rootcause property.
> > 
> > If you have access to the server locally, you can also try turning
on
> > Debug level logging for the AMF Gateway in
> > /WEB-INF/flex/gateway-config.xml and checking your Flex logs (or
> > possibly just watching the console output if you manually launch
JRun
> > and have console logging enabled for Flex). This will show you what
> data
> > type was being deserialized for your input parameter and it will
also
> > let you see the raw response going back with information similar to
> that
> > shown in the NetConnection Debugger (though the server side is more
> > accurate as the NCD is an old Flash Remoting tool that has a few
> issues
> > - mainly that it doesn't show objects typed with
> Object.registerClass).
> > 
> > 
> >  
> > 
> > -----Original Message-----
> > From: cazzaran [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, March 28, 2005 4:58 PM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Re: Error: Cannot invoke method when using a
VO
> > 
> > 
> > 
> > Peter,
> > 
> > Here's my whitelist:
> > 
> > <whitelist>
> >     <unnamed>
> >         <source>*</source>
> >     </unnamed>
> >     <named>
> >         <object name="userDelegate">
> >             <source>businessdelegates.UserDelegate</source>
> >             <type>stateful-class</type>
> >             <allow-unnamed-access>false</allow-unnamed-access>
> >         </object>
> >         <object name="groupDelegate">
> >             <source>businessdelegates.GroupDelegate</source>
> >             <type>stateful-class</type>
> >             <allow-unnamed-access>false</allow-unnamed-access>
> >         </object>
> >     </named>
> > </whitelist>
> > 
> > -Josh
> > 
> > --- In flexcoders@yahoogroups.com, "Peter Farland" <[EMAIL PROTECTED]>
> > wrote:
> > > Ah, what does the unnamed whitelist in the remote-object section
> look
> > > like? Does it include your Group class? I apologize for not double
> > > checking whether it was still a requirement in Flex 1.5, but I
know
> it
> > > was in Flex 1.0.
> > > 
> > > -----Original Message-----
> > > From: cazzaran [mailto:[EMAIL PROTECTED] 
> > > Sent: Monday, March 28, 2005 4:19 PM
> > > To: flexcoders@yahoogroups.com
> > > Subject: [flexcoders] Re: Error: Cannot invoke method when using a
> VO
> > > 
> > > 
> > > 
> > > Peter,
> > > 
> > > It does... 
> > > 
> > > -Josh
> > > 
> > > --- In flexcoders@yahoogroups.com, "Peter Farland" <[EMAIL PROTECTED]>
> > > wrote:
> > > > Does the Java version of Group have a public no args
constructor?
> > > > 
> > > > 
> > > > -----Original Message-----
> > > > From: cazzaran [mailto:[EMAIL PROTECTED] 
> > > > Sent: Monday, March 28, 2005 3:50 PM
> > > > To: flexcoders@yahoogroups.com
> > > > Subject: [flexcoders] Error: Cannot invoke method when using a
VO
> > > > 
> > > > 
> > > > 
> > > > I have a delegate class on my server called GroupDelegate, and
it
> > has
> > > > a method addGroup(Group group).
> > > > 
> > > > When I try and call this method on my remote object, I get the
> > error:
> > > > 
> > > > Error: Cannot invoke method addGroup
> > > > 
> > > > However, if I switch my method's signature to addGroup(String
> > > > groupName), the method executes, and the group is added to the
DB.
> > > > 
> > > > Group is just a POJO, and obviously the second method wont work
> > > > because there is a lot more information than just the groupName
> that
> > > > needs to be recorded...
> > > > 
> > > > Interestingly, when I do a getGroups I get back an array of the
> > > > correct objects, and in my client side model of my Group class I
> > have
> > > > correctly done the Object.registerClass. The only time I seem to
> > have
> > > > an issue is when I pass it BACK to my server as a Group.
> > > > 
> > > > Any ideas? -Josh
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > >  
> > > > Yahoo! Groups Links
> > > 
> > > 
> > > 
> > > 
> > > 
> > >  
> > > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> > 
> >  
> > Yahoo! Groups Links
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links





 
Yahoo! Groups Links



 





 
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/
 


Reply via email to