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

snelson’s picture

Assigned: Unassigned » snelson
Status: Active » Fixed

Commited a fix to D5 and D6

threexk’s picture

I confirm the fix works for D6, thanks. Optional arguments don't seem to work, but I'll open a separate issue for that.

Status: Fixed » Closed (fixed)

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