Extension interoperability not working in server AS

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Extension interoperability not working in server AS

Post by Pippoflash »

Hi,
I tried any way to communicate with another extension in server side AS, but I always get the same error:
----------------------------------------------------------
[MainExt.as]: extension found? it.gotoandplay.smartfoxserver.extensions.Javascri
ptExtension@1e85adf
22:31:42.945 - [ INFO ] > { DATA OUT } : <msg t='xt'><body action='xtRes' r='-1'
><![CDATA[<dataObj><var n='r' t='x' /><var n='m' t='s'>[MainExt.as]: Does it hav
e a method? function handleInternalRequest() {/*
java.lang.Object handleInternalRequest(java.lang.Object)
*/}
</var><var n='_cmd' t='s'>trace</var><var n='z' t='s'>CardGamesZone</var></dataO
bj>]]></body></msg>
[MainExt.as]: Does it have a method? function handleInternalRequest() {/*
java.lang.Object handleInternalRequest(java.lang.Object)
*/}

org.mozilla.javascript.EvaluatorException: Can't find method it.gotoandplay.smar
tfoxserver.extensions.JavascriptExtension.handleInternalRequest(). (MainExt.as#1
627)
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultError
Reporter.java:109)
-------------------------------------

As you can see from the first line, I can successfully locate the other extension, and it gets traced. Also, I try to trace the method, and it successfully locates it. BUT whenever I try to call the same method (that just traced successfully) it never works.

thanks
Filippo
-----------------------
www.pippoflash.com
-----------------------
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

Please show us the snippet of code that was used to trace out those tests.
Smartfox's forum is my daily newspaper.
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Post by Pippoflash »

Sure here it is,
it's part of a OOP-like fraework implemented in server side js, so it may not be too clear... anyway all extension inherit from this.

Code: Select all

System.prototype.callExtension				= function(extName, method, par) {
	trace								("calling extension: "+extName+"."+method+"() " + this._zone);
	
	this._ext							= this._zone.getExtension(extName);
	trace								("extension found? "+this._ext);
	trace								("Does it have a method? " + this._ext.handleInternalRequest);
	trace								("Letrs call it: "+this._ext.handleInternalRequest());
	if (par)							return this._ext.handleInternalRequest(par);
	else								return this._ext.handleInternalRequest();
}

It's supposed to call a custom method in the desired extension, but since it wasn't working I tried calling handleInternalRequest() directly.

If you look at the trace statements,
the first 2 are traced (extension, and method found), the third, which invokes the method, doesnt execute and triggers an error.

thanks a lot!
-----------------------
www.pippoflash.com
-----------------------
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

It seems that the exception is occurring on the following line:

trace("Letrs call it: "+this._ext.handleInternalRequest());

So perhaps it's complaining because you're not passing any parameters to the method.
Smartfox's forum is my daily newspaper.
Post Reply