As talked about on IRC - prefixing resources actions in the xmlrpc server results in it being impossible to replicate most major xmlrpc-api:s with Services - which should really be possible if anything like the Blog API should be able to use it in the future.

CommentFileSizeAuthor
#4 1016350.patch5.44 KBgdd
#2 1016350.patch2.78 KBgdd

Comments

gdd’s picture

If I read the module right we also prefix relationships and targeted actions correct? I'd like to do this but I need to get a patch together.

gdd’s picture

Version: 7.x-3.0-beta2 » 7.x-3.x-dev
StatusFileSize
new2.78 KB

Here's a patch albeit untested.

voxpelli’s picture

Priority: Major » Critical
Status: Active » Needs work

By removing the prefix of all three we're risking collisions - but I guess that is okay. Fact is we're already risking collisions as services_controller_get() and services_controllers_list() apparently already works this way (but with the order: 'actions', 'relationships', 'targeted actions'). So I guess actions isn't working at all in XML-RPC right now? Moving to critical.

Since services_controller_get() and services_controllers_list() and _xmlrpc_server_resources_as_procedures() deals with the same functionality I wonder why they have been split up between two modules? I think that either _xmlrpc_server_resources_as_procedures() should be moved out of the XML-RPC module or services_controller_get() and services_controllers_list() should be moved in to it. Considering we've a lot of RPC-style third party servers for Services 2.x I think we should move _xmlrpc_server_resources_as_procedures() out of the XML-RPC module to make methods for converting resources into RPC-methods available for them.

Also - to consistently resolve collisions I think we should define a order of precedence. Most resources wont be constructed with RPC in mind so it's quite important to solve collisions correctly I think. This is what services_controller_get() does today - it's probably the best:

Crud methods > Actions > Relations > Targeted Actions

I think we should move _xmlrpc_server_resources_as_procedures() as part of this issue as well as ensuring that it handles collisions in a good consistent way.

gdd’s picture

StatusFileSize
new5.44 KB

That is a good idea. Here is a new patch that moves the resources_as_procedures() calls into services.module, and adjusts the order of precedence to match the REST Server one. Still not tested.

gdd’s picture

Status: Needs work » Needs review
deviantintegral’s picture

I blindly tried the patch in #3 to 6.x-3.x-dev, and I can now call the system.get_variable() method successfully over xmlrpc. I'll give it a full review soon.

voxpelli’s picture

Status: Needs review » Needs work

Just looking at the code it seems like a good patch - except for:

+++ services.module	15 Jan 2011 18:21:45 -0000
@@ -512,3 +512,55 @@ function services_controller_get($name, 
+    'method' => $resource .'.'. $name,

There should be some spaces between the . and ' ;)

+++ servers/xmlrpc_server/xmlrpc_server.module	15 Jan 2011 18:21:45 -0000
@@ -43,7 +44,7 @@ function xmlrpc_server_xmlrpc() {
-      foreach (_xmlrpc_server_resources_as_procedures($def) as $method) {
+      foreach (services_resources_as_procedures($def) as $method) {
         $callbacks[$method['method']] = 'xmlrpc_server_call_wrapper';
       }

The order of precedence is not preserved here - right? Either we need to reverse the loop or we need to check that the method hasn't actually been set.

Powered by Dreditor.

ygerasimov’s picture

Patch works. I have written test to call action without prefix after applying this patch. You can see it in #1072844: XMLRPC server. All possible calls get listed in system.listMethods. BTW when I was writing the test without this patch applied I was not able to call action with prefix. So this functionality looks broken anyway.

voxpelli’s picture

@ygerasimov: Do you test that order of precedence is correct?

ygerasimov’s picture

@voxpelli no I don't. But in order to do that I need to create test resource and enable it. Do you think whether it is reasonable to do?

voxpelli’s picture

A test resource sounds reasonable I think.

ygerasimov’s picture

I have added test resource and precedence test to http://drupal.org/node/1072844#comment-4143538

gdd’s picture

Status: Needs work » Closed (fixed)

OK this has been committed.

gdd’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Status: Closed (fixed) » Patch (to be ported)

Kyle pointed out this needs to be ported

voxpelli’s picture

@heyrocker: Did you fix my feedback in #7?

kylebrowning’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.