Submit handler to query system.listMethods.

Submit: query the XML-RPC endpoint for the method system.listMethods and report the result as a Drupal message. The result is a list of the available methods in this XML-RPC server.

Important note: Not all XML-RPC servers implement this method. Drupal's built-in XML-RPC server implements this method by default.

Parameters

array $form: Form array.

array $form_state: Form_state array.

See also

xmlrpc()

xmlrpc_errno()

xmlrpc_error_msg()

Related topics

1 string reference to 'xmlrpc_example_client_request_methods_submit'
xmlrpc_example_client_form in xmlrpc_example/xmlrpc_example.module
Returns a form array to take input for two arguments.

File

xmlrpc_example/xmlrpc_example.module, line 417
Module file for xmlrpc_example module.

Code

function xmlrpc_example_client_request_methods_submit($form, &$form_state) {

  // First define the endpoint of the XML-RPC service, in this case this is our
  // own server.
  $server = url($GLOBALS['base_url'] . '/xmlrpc.php', array(
    'external' => TRUE,
  ));

  // Then we should define the method to call. xmlrpc() requires that all the
  // information related to the called method be passed as an array in the form
  // of 'method_name' => arguments_array
  $options = array(
    'system.listMethods' => array(),
  );

  // Make the xmlrpc request and process the results.
  $result = xmlrpc($server, $options);
  if ($result === FALSE) {
    drupal_set_message(t('Error return from xmlrpc(): Error: @errno, Message: @message', array(
      '@errno' => xmlrpc_errno(),
      '@message' => xmlrpc_error_msg(),
    )), 'error');
  }
  else {
    drupal_set_message(t('The XML-RPC server returned this response: <pre>@response</pre>', array(
      '@response' => print_r($result, TRUE),
    )));
  }
}