Closed (fixed)
Project:
Services
Version:
6.x-0.13
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
30 Jan 2009 at 02:51 UTC
Updated:
2 Mar 2009 at 20:20 UTC
If you create a service method with a required boolean argument and pass it the value false, you will get the error "Missing required arguments." Passing true to the method works, however.
Test module code:
function test_service_service() {
return array(
array(
'#method' => 'test_service.testcall',
'#callback' => 'test_service_testcall',
'#args' => array(
array(
'#name' => 'val',
'#type' => 'boolean',
'#description' => t('A value'),
),
),
'#return' => 'string',
),
);
}
function test_service_testcall($val) { return $val; }
Test client code (Python):
import xmlrpclib
server = xmlrpclib.Server("http://www.example.com/services/xmlrpc")
print server.test_service.testcall(False)
I also tested with a Perl client, so I think that rules out the client as a problem. Interestingly everything works fine from the Services browser. Finally, as a workaround you can set the argument to optional and successfully pass False, but passing no arguments will fail (i.e., the argument is not actually optional.)
Comments
Comment #1
snelson commentedCommited a fix to D5 and D6
Comment #2
threexk commentedI confirm the fix works for D6, thanks. Optional arguments don't seem to work, but I'll open a separate issue for that.