I'm trying the examples in the docs and I get this error:

stdClass Object
(
[is_error] => 1
[code] => -32602
[message] => Server error. Wrong number of method parameters.
)

http://drupal.org/node/394364
http://drupal.org/node/394224

Comments

marcingy’s picture

Category: bug » support
gdd’s picture

Did you ever resolve this issue? If not can you provide some details as to what method(s) you were calling and what parameters you were using? If I don't hear back in a couple day's I'm going to close this issue. Thanks.

joachim’s picture

I don't have access to the machine I was working on back then.
But I reckon looking at those links I was trying the basic example on http://drupal.org/node/394364 --

// Get anon session. system.connect is the only service that does
// not require a sessionid even when you have 'Use Sess ID' checked.
$xmlrpc_url = 'http://localhost/services/xmlrpc';
$anon_session = xmlrpc($xmlrpc_url, 'system.connect');

// Use anon session id to login with authentication
$user = 'foo';
$password = 'bar';
$authenticated_session = xmlrpc($xmlrpc_url, 'user.login', $anon_session['sessid'], $user, $password);
skyredwang’s picture

I don't think that documentation is accurate,
line: $authenticated_session = xmlrpc($xmlrpc_url, 'user.login', $anon_session['sessid'], $user, $password); looks like it's missing signature as a parameter.

Close this issue for now, since so many things have happened. If you give this another try, and still have problem, feel free to re-open it.

joachim’s picture

Component: Code » Documentation
Category: support » bug

If the docs are wrong then this is a bug on docs ;)

gdd’s picture

Status: Active » Closed (won't fix)

The main reason that you would get the wrong number of parameters error is that you have sessions enabled AND key auth. I know the example is correct, this is exactly what Deploy uses and when I wrote it at the coding sprint at Drupalcon DC both marcingy and snelson tested it. So I'm going to chalk this up to a local config problem unless someone can prove me wrong.

joachim’s picture

Could those docs page be updated to give the right settings for Services to go with the examples then?
I certainly remember back when I filed this I had no idea that changing the settings for keys or sessions would change the number of parameters to send!

(Also, btw: is it bad / pointless to use both sessions and key auth?)

skyredwang’s picture

sessions are required for Key Auth.

I think the old dev-2.x branch requires an authentication, and at that time Key Auth was the only option. But, Services roadmap suggests that the OAuth is going to replace Key Auth as the default, and REST server as default server. So, a lot of implementation needed to be updated. Your request is very specific for JSON/XMLRPC + KeyAuth combination.

joachim’s picture

I sort of see what you mean by 'very specific', but I think you're missing the point.
Those docs pages should be usable. The examples should work. If you need a particular configuration for the examples to work, and if another configuration breaks those examples, then those examples must say so.