Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Registering a custom function to be invoked by webservice
#1
I know I've asked this before, but I'm still a bit fuzzy on this:

What are the basic steps to register a new webservice function (for instance in a module's postinstall), so that it can be invoked from the outside (by the doInvoke command) through webservice?

So far I've found this in the repo. Is that a good lead?
Reply
#2
Hm. It seems if I create a new webservice operation I can pass its name here and the params with it, and if I'm not mistaken I need to name the function the same as the handler_method in the vtiger_webservice_operations table. But I'm not sure how my $params from the doInvoke method will end up in my custom function and what the prescribed way is to register this new operation.
Reply
#3
The $params is an array with all the parameters defined in the webservice method:

https://github.com/tsolucio/coreBOSwsDev...ad.php#L23

that is the call to this method:

https://github.com/tsolucio/corebos/blob...ad.php#L15

one parameter which is the one value in the array in the call. You ALWAYS have to define the $user when you define the method, not when you register it, only when you code it. The user calling the method is always passed in as the last parameter.

There is no obligation to define the method function and the exported webervice name the same, in fact they are usually different:

https://github.com/tsolucio/corebos/blob...omment.php

The easiest way to register the method is using the registerWSAPI() method

https://github.com/tsolucio/corebos/blob...s.php#L383
Joe
TSolucio
Reply
#4
Thanks! Gets me on my way, and hopefully some help for someone looking for the same..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)