I have a site which acts as cas server. This site is meant to act a central authentication server for affiliate sites. The user account is created on this site. Each user is associated with customer profile using profile2 module. I want to map the profile2 content/fields from the cas server site to affiliate site so that the profile data so mapped can be used on affiliate site. I have already created the following service endpoint on the cas server site:
$endpoint = new stdClass();
$endpoint->disabled = FALSE; /* Edit this to true to make a default endpoint disabled initially */
$endpoint->api_version = 3;
$endpoint->name = 'content_provider';
$endpoint->server = 'rest_server';
$endpoint->path = 'contentprovider';
$endpoint->authentication = array(
'services' => 'services',
);
$endpoint->server_settings = array(
'formatters' => array(
'bencode' => TRUE,
'json' => TRUE,
'jsonp' => TRUE,
'php' => TRUE,
'rss' => TRUE,
'xml' => TRUE,
),
'parsers' => array(
'application/json' => TRUE,
'application/vnd.php.serialized' => TRUE,
'application/x-www-form-urlencoded' => TRUE,
'application/xml' => TRUE,
'multipart/form-data' => TRUE,
'text/xml' => TRUE,
),
);
$endpoint->resources = array(
'node' => array(
'alias' => 'node',
'operations' => array(
'retrieve' => array(
'enabled' => '1',
),
'index' => array(
'enabled' => '1',
),
),
),
'user' => array(
'alias' => 'user',
'operations' => array(
'retrieve' => array(
'enabled' => '1',
),
'index' => array(
'enabled' => '1',
),
),
),
'views' => array(
'operations' => array(
'retrieve' => array(
'enabled' => '1',
),
),
),
'profiles2-data' => array(
'alias' => 'profile',
'operations' => array(
'index' => array(
'enabled' => '1',
),
),
),
);
$endpoint->debug = 0;
I have tested the service endpoint by going to domain.com/contentprovider/profile and it seems to work. I can see all the profile data in xml format. I have created profile2 resource using services_views.
However I am finding it difficult to implement the wsclient on the affiliate/client site. I am really a newbie in the field of web services. Some helpful points on how I should proceed in defining web services description and corresponding rules would be really helpful. How should I define operation and data type (profile2 field on cas server contains text and integer fields only) in service description. What should be the selection for "React on event" in rules. I tried selecting Corn run as reaction event.
Thanks a lot.