简体   繁体   中英

vtiger 6.4 vtwsclib doInvoke() custom webservice not working

I'm trying to call a custom webservice from an external php file but it's not working. In order to create the custom webservice I followed this post ( How to Create custom operation for Webservice VtigerCRM? ), so I first ran a query to add the new webservice in vtiger_ws_operation table:

INSERT INTO `vtiger_ws_operation` ( `name`, `handler_path`, `handler_method`, `type`, `prelogin`) VALUES ('my_webservice_method', 'include/Webservices/WbsWebserviceMethod.php', 'vtws_my_webservice_method’, 'GET', 0);

then I added a new row in vtiger_ws_operation_parameters with the only parameter I need for this webservice:

INSERT INTO `vtiger_ws_operation_parameters` (`operationid`, `name`, `type`, `sequence`) VALUES (35, 'key', 'String', 1);

finally, I added my php file 'include/Webservices/WbsWebserviceMethod.php':

<?php
function vtws_my_webservice_method($key) {
    global $log,$adb;
    return "ok";
}
?>

But when I try and call this webservice from my external file, it returns false:

$results = $client->doInvoke(
    'vtws_my_webservice_method',
    array('key' => $date),
    'GET'
);
var_dump($results);

What am I doing wrong?

The method name exposed to the outside world is the name column - my_webservice_method in your case. So your code should be something like -

$results = $client->doInvoke(
    'my_webservice_method',
    array('key' => $date),
    'GET'
);
var_dump($results);

Please let me know if this works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM