[Helma-user] implementing metaweblogapi using "new-style" xmlrpc

Stefan Rinner rist at mac.com
Thu Sep 28 17:07:31 CEST 2006


On Sep 28, 2006, at 4:35 PM, Michael Platzer wrote:

> Stefan Rinner schrieb:
>> So, is it not possible to implement something like the metaWeblogAPI
>> with a single endpoint and several methods in the new-style?
>> Currently I added a switch statement to main_action_xmlrpc to route
>> my calls, but this isn't that nice.
>>
> it isn't nice, but it is working. we have got the following action
> defined in Root:
>
> function xmlrpc_action_xmlrpc(method, param0, param1, param2, param3,
> param4, param5, param6, param7, param8, param9) {
>    var mountpoint = method.split('.')[0];
>    var functionName = method.split('.')[1];
>    if (root[mountpoint][functionName + "_xmlrpc"]) {
>       return root[mountpoint][functionName + "_xmlrpc"](param0,  
> param1,
> param2, param3, param4, param5, param6, param7, param8, param9);
>    }
> }

I replaced my switch statement now with this (and kept the  
"_action_xmlrpc" suffix of my functions) - probably still have to add  
more errorchecking

function main_action_xmlrpc( methodName ) {
	var method =  
app.__app__.currentRequestEvaluator.scriptingEngine.core.getPrototypePro 
perties( "MetaWeblogAPI" )[ methodName.split( "." )[ 1 ] +  
"_action_xmlrpc" ];
	if( method )
		return method.apply( this, arguments );
}


- stefan


More information about the Helma-user mailing list