Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My first questions after studying MYC portal
#1
As I'm preparing for the development of my portal, I'm studying the MYC portal on github. I see it has a lot of useful library's I can use. The first question that comes to mind: What is the difference between vtigerservice.php file and webservice.php file? Do they serve the same purpose, but different techniques?

AlsoL I see in the WSClient file in the portal a "doInvoke" method, where you can invoke custom methods. Does this mean custom methods on a module level? So I could create a module that registers some webservice method, which I can invoke through this action?
Reply
#2
I trust you are looking at our adaption of this project:

https://github.com/tsolucio/coreBOSMYCCP

which has some enhancements, fixes and support for corebos WS. I also have a SalesOrder module if you are interseted.

vtigerservice uses SOAP, that was a technology used ages ago and that is now obsolete, you shouldn't use that but the guys at MyC decided to do it that way. You should use webservice.

Invoke is exactly that, you can create your own methods and call them with the generic doInvoke method:

https://github.com/tsolucio/coreBOSwsDev...rtLead.php

keep asking....
Joe
TSolucio
Reply
#3
Yes, I am looking at the coreBOS version on your Github account.

Good to know, I'll focus my attention on webservice. I'd very much like to see the SO webservice.

About you doInvoke example: that represents a file on the portal side right? You invoke the 'convertlead' method, but where would that be defined? In the general webservice file or in a module? And if so, how can you register webservice methods in the app from a module?
Reply
#4
(11-29-2016, 08:04 AM)Guido1982 Wrote: Good to know, I'll focus my attention on webservice. I'd very much like to see the SO webservice.

I attached the plugin. You have to go to Settings > Plugin Manager and upload it there. If I remember correctly it uploads it to the wrong directory and you have to manually move it to the right place. I never got around to investigating but it is probably here:

https://github.com/tsolucio/coreBOSMYCCP...ex.php#L68

I think that has to be:


PHP Code:
$zip->extractTo(ROOT_PATH.'/plugins'); 

at least that is where I have that code now.
Let me know how that goes.



(11-29-2016, 08:04 AM)Guido1982 Wrote: About you doInvoke example: that represents a file on the portal side right? You invoke the 'convertlead' method, but where would that be defined? In the general webservice file or in a module? And if so, how can you register webservice methods in the app from a module?

Yes, that code would be on the portal side.
To register a new webservice you have to call the registerWSAPI() function:

https://github.com/tsolucio/corebos/blob...s.php#L401

that accepts an array with the definition of the new method: where it lives, what it is called, it's parameters,....

https://github.com/tsolucio/corebos/blob...s.php#L385

You have a whole bunch of examples here:

https://github.com/tsolucio/corebos/tree.../wsChanges

which are the new ones we have added on top of vtiger CRM's default ones.


Attached Files
.zip   apisalesorder.zip (Size: 5.26 KB / Downloads: 0)
Joe
TSolucio
Reply
#5
Wow,

That's a lot. I've taken a look. Basically I could create a file in a new module and register the webservice method using 'registerWSAPI'. What's the 'prelogin' part? Also, if I specify a certain type (e.g. "POST", will it fail when I try it through a GET request? Is it mandatory to set the 'queryParameters' type in the 'parameters' in the 'operationInfo'? Basically I could make a webservice method that returns records from my module in any form I like, in array form? The webservice file will automatically JSON encode?

Lot of info, lot's of questions. But cool techniques.
Reply
#6
(11-29-2016, 03:35 PM)Guido1982 Wrote: Basically I could create a file in a new module and register the webservice method using 'registerWSAPI'.

Correct

(11-29-2016, 03:35 PM)Guido1982 Wrote: What's the 'prelogin' part?

if set to 1 you will be able to access the service without requiring a valid login. It will be an open service, for example, getchallenge and login are open. If set to 0 you will only be able to use the service with a valid login session.


(11-29-2016, 03:35 PM)Guido1982 Wrote: Also, if I specify a certain type (e.g. "POST", will it fail when I try it through a GET request?

Yes, this is checked and will fail if you use the wrong method.

(11-29-2016, 03:35 PM)Guido1982 Wrote: Is it mandatory to set the 'queryParameters' type in the 'parameters' in the 'operationInfo'?

yes.

(11-29-2016, 03:35 PM)Guido1982 Wrote: Basically I could make a webservice method that returns records from my module in any form I like, in array form? The webservice file will automatically JSON encode?

webservice will automatically JSON encode. it will always be a JSON response
Joe
TSolucio
Reply
#7
Thanks! Will keep this nearby as soon as I start. First to create a first alpha of my PackingSlip module...
Reply
#8
Well, I've borrowed some code from the portal and installed Smarty 3 in my project. I've managed to login, retrieve contacts and display them with smarty in just over an hour so so far, so good!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)