Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating a module record from a workflow via webservice
#6
Let me try to clarify a little.

You actually have two ways of saving information in the application:

1.- from within the application: you are executing your code inside the same server and the same directory where coreBOS is installed and the whole application infrastructure is loaded. This is the case of an event handler, a workflow, a custom module or a direct vtlib script that has included vtlib/Module.php

2.- from outside the application using webservice. this can be executed on any server anywhere (even the same server coreBOS install is on) and all it needs from the coreBOS install is it's URL and a valid user to connect.

In the first case you can use the system's save() process which is explained here:

http://corebos.org/documentation/doku.php?id=en:devel:saverecordfromwithin

In the second case you can either call the webservice directly

https://github.com/tsolucio/coreBOSwsDevelopment/blob/master/testcode/020_createContact.php

or use one of the many libraries that are available that will make it a bit easier:

https://github.com/tsolucio/coreBOSwsDevelopment/blob/master/testcode/020lib_createContact.php

---------------------

Ok, so now we have only two ways of creating: inside save() and outside webservice

As you can see the internal save() process suppose a lot of things, the information is coming from the browser in a specific format, a user is connected, certain $_REQUEST variables must exist.... which make it a bit complicated. So, as an alternative we can benefit that the webservice interface takes care of most of these details and call the webservice functions directly.

The idea is that you are inside the application, so you have access to EVERYTHING that is there, that includes all the webservice code. You can call the webservice functions just as you would call any other function in the system. So when calling doCreate() from outside the application, that ends up (after validating the user and doing a bunch of other things) calling the function vtws_create(), since we are already inside the application environment (in your case) then you can call this function directly with no overhead of validating and with no complicated formatting issues because vtws_create() will take care of that. It is just an easier way of manipulating the information, in the end ALL will call the save() method.

keep asking :-)
Joe
TSolucio
Reply


Messages In This Thread
RE: Creating a module record from a workflow via webservice - joebordes - 12-16-2015, 12:59 PM

Forum Jump:


Users browsing this thread: 7 Guest(s)