Services Newbie Question

Events happening in the community are now at Drupal community events on www.drupal.org.
dewolfe001's picture

I've been trying to build two modules that will talk to each when installed on separate sites. The functions appear to work in unit testing, but they do not talk to each other. I am not sure what I'm doing wrong. I made up a hook_xmlrpc and a hook_service function to see if that was the difference, but no luck there.

Function on calling site and the function that "should" be calling the remote site:

// basically the cron job-- the tool that updates the links and spiders for new entries
function plrhub_update_index($site_id = -1) {
    if ($site_id == -1) {
      $result = db_query_range('SELECT site, site_id, api_key, last_index FROM {plrhub_site} WHERE status = 1 AND UNIX_TIMESTAMP() < (last_index + frequency + site_id)', 0, 10);   
   }
  else {
     $result = db_query_range('SELECT site, site_id, api_key, last_index FROM {plrhub_site} WHERE status = 1 AND site_id = '.intval($site_id), 0, 10);
    }

while ($site = db_fetch_object($result)) {
     $node_list = xmlrpc($site->site.'/xmlrpc.php',  'plrex.getNodeList', -1, array(), array(), -1, -1, -1, $site->last_index, $site->api_key);

       watchdog('plrhub',' going to '.$site->site.'/xmlrpc.php for <pre>'.print_r($node_list, TRUE).'</pre>');

        db_query('UPDATE plrhub_site SET last_index = %d WHERE site_id = %d', time(), $site->site_id);
        $plrhub_list = plrhub_update_list($node_list, $site->site_id);
      plrhub_update_search($plrhub_list);
    }
}

Function on remote site that would have to be called:

function plrex_xmlrpc() {
  return array(
    array(
      'plrex.getNodeList',
      'plrex_service_node_list',
      array('int', 'array', 'array', 'int', 'int', 'int', 'int', 'string'),
      t('Returns a list of nodes that match your criteria.'))
);
}

function plrex_service() {
  return array(
    // plrex.getNodeList
    array(
      '#method'   => 'plrex.getNodeList',
      '#callback' => 'plrex_service_node_list',
      '#args'     => array(
        array(
          '#name'         => 'nid',
          '#type'         => 'int',
          '#description'  => t('A node id.')),
        array(
          '#name'         => 'fields',
          '#type'         => 'array',
          '#optional'     => TRUE,
          '#description'  => t('A list of fields to return.')),
        array(
          '#name'         => 'tids',
          '#type'         => 'array',
          '#optional'     => TRUE,
          '#description'  => t('The terms that match the taxonomy of a list')),
        array(
          '#name'         => 'plrx.ratings',
          '#type'         => 'int',
          '#optional'     => TRUE,
          '#description'  => t('Minimum ratings')),
        array(
          '#name'         => 'plrx.downloads',
          '#type'         => 'int',
          '#optional'     => TRUE,
          '#description'  => t('The maximum number of downloads')),
        array(
          '#name'         => 'plrx.cost',
          '#type'         => 'int',
          '#optional'     => TRUE,
          '#description'  => t('Maximum cost')),
        array(
          '#name'         => 'changed',
          '#type'         => 'int',
          '#optional'     => TRUE,
          '#description'  => t('Changed date')),
     array(
          '#name'         => 'api_key',
          '#type'         => 'string',
          '#description'  => t('The API Key'))),
      '#return'   => 'struct',
      '#help'     => t('Returns a list of nodes that match your criteria.')),
  );
}

I have a watchdog log on the remote site and there is no sign of the local site calling the remote site. When I called the "plrex_service_node_list" function in a test on the remote site (from a test page calling the function), that function worked fine in isolation. I am not getting back any errors of any sort-- just the absence of output from the remote site and it looks like it's not called in the first place.

Any ideas? Any pointers? Any where I can dig for more info on what I'm missing?

Services

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week