From gyczew at poczta.fm Sun Jan 24 11:09:48 2010 From: gyczew at poczta.fm (Grzegorz Gyczew) Date: Sun, 24 Jan 2010 20:09:48 +0100 Subject: [SabreAMF] SabreAMF - Class Mapping - why function receives SabreAMF_TypedObject instead of registered Class Message-ID: <468297763.20100124200948@poczta.fm> Hi ! I'd like to ask about the class mapping problem which I cannot solve. I have made test Flex app that calls remote service passing as an argument TestVO object. I intended to use type hinting in the function definition "function setData(TestVO $vo){...}" but I have received "PHP Catchable fatal error...". Earlier I was convinced that SabreAMF_ Eric Renaun's gateway will map and invoke function with object as an instance. So I have started to dig in and debug services call received by the server side php script. In the archive I found Evert' reply (to similar problem) where he wrote: "The problem here is, that the entire request has already completely been handled and decoded. So, the trick is to call registerClass before anything else.. (so before you hit $server->exec())." OK so I have put SabreAMF_ClassMapper::registerClass in the sequence given below: $server = new SabreAMF_CallbackServer(); $server->onInvokeService = 'myCallback'; SabreAMF_ClassMapper::registerClass('TestVO' ,'TestVO'); $server->exec(); But I cannot see (when debugging) any call to remapping of the $request['data']->body which is already SabreAMF_TypedObject after deserialization invoked in the constructor of SabreAMF_Server class. Variable $request['data'] has necesary information about the local ClassName $request['data'] = (amfClassName => 'TestVO', amfData => array(name => 'some name', id => 77) ) Is there any built-in way to remap $request['data'] to contain TestVO object instance that could be passed as an argument to the function? I have tested with Eric's gateway, and then finally with modified callback based on http://code.google.com/p/sabreamf/wiki/CallbackServer and the rest of the service class and VO object class files kept in the root folder of callback - with the same result. -- Best Regards, Greg Gyczew mailto:gyczew at poczta.fm From evert at rooftopsolutions.nl Tue Jan 26 23:33:29 2010 From: evert at rooftopsolutions.nl (Evert | Rooftop) Date: Wed, 27 Jan 2010 16:33:29 +0900 Subject: [SabreAMF] SabreAMF - Class Mapping - why function receives SabreAMF_TypedObject instead of registered Class In-Reply-To: <468297763.20100124200948@poczta.fm> References: <468297763.20100124200948@poczta.fm> Message-ID: <10959D1B-D677-4C3F-BD9B-2642501B4B7A@rooftopsolutions.nl> Hi Grzegorz, Classmapping is done during deserialization (like you probably suspected). I must ask the obvious questions: * Is the class actually included, or do you have an autoloader? * What is the full error message? Evert On 2010-01-25, at 4:09 AM, Grzegorz Gyczew wrote: > Hi ! > > I'd like to ask about the class mapping problem which I cannot solve. > > I have made test Flex app that calls remote service passing as an > argument TestVO object. I intended to use type hinting in the function > definition "function setData(TestVO $vo){...}" but I have received > "PHP Catchable fatal error...". Earlier I was convinced that SabreAMF_ > Eric Renaun's gateway will map and invoke function with object as an > instance. So I have started to dig in and debug services call received > by the server side php script. > > In the archive I found Evert' reply (to similar problem) where he wrote: > > "The problem here is, that the entire request has already completely > been handled and decoded. > So, the trick is to call registerClass before anything else.. (so > before you hit $server->exec())." > > OK so I have put SabreAMF_ClassMapper::registerClass in the sequence > given below: > $server = new SabreAMF_CallbackServer(); > $server->onInvokeService = 'myCallback'; > SabreAMF_ClassMapper::registerClass('TestVO' ,'TestVO'); > $server->exec(); > > But I cannot see (when debugging) any call to remapping of the > $request['data']->body which is already SabreAMF_TypedObject after > deserialization invoked in the constructor of SabreAMF_Server > class. > > Variable $request['data'] has necesary information about the local ClassName > $request['data'] = (amfClassName => 'TestVO', > amfData => array(name => 'some name', > id => 77) > ) > > Is there any built-in way to remap $request['data'] to contain TestVO object > instance that could be passed as an argument to the function? > > I have tested with Eric's gateway, and then finally with modified > callback based on > http://code.google.com/p/sabreamf/wiki/CallbackServer and the rest of > the service class and VO object class files kept in the root folder of > callback - with the same result. > > > -- > Best Regards, > Greg Gyczew mailto:gyczew at poczta.fm > > > _______________________________________________ > sabreamf mailing list > sabreamf at osflash.org > http://osflash.org/mailman/listinfo/sabreamf_osflash.org