function wsclient_service_action in Web service client 7
Action callback: invoke a web service.
1 string reference to 'wsclient_service_action'
- WSClientServiceDescription::actions in ./
wsclient.inc - Returns info about the actions of the web service.
File
- ./
wsclient.rules.inc, line 124 - Web service client - Rules integration.
Code
function wsclient_service_action($arguments, RulesPlugin $element) {
if ($service = wsclient_service_load($arguments['service'])) {
$args = array();
foreach ($arguments as $name => $data) {
if (strpos($name, 'param_') === 0) {
// Remove the parameter name prefix 'param_'.
$args[substr($name, 6)] = $data;
}
}
try {
$return = $service
->invoke($arguments['operation'], $args);
} catch (Exception $e) {
throw new RulesEvaluationException($e
->getMessage(), array(), $element, RulesLog::ERROR);
}
return array(
'result' => $return,
);
}
else {
throw new WSClientException('The web service %name cannot be found.', array(
'%name' => $arguments['service'],
));
}
}