ws_update(content):Boolean to update data
By performing an HTTP PUT on the url <serverUrl>/servoy-service/rest_ws/solutionName/formName, the ws_delete() method will be invoked. Data has to be supplied in the body of the HTTP request. Additional arguments can be specified in the url, like <serverUrl>/servoy-service/rest_ws/solutionName/formName/value1/value2. The arguments will be applied to the invocation of ws_delete(content), after the content parameter.
My first question is: is not a mistake in the documentation and instead of “the ws_delete() method will be invoked” should be “the ws_update() method will be invoked”?
Why the HTTP PUT request cannot be done from an external server? I have a php application that makes the parse of the xml when retrieving data and after that an update with the modified data. So for this I need a php server. In the sample solution, there is an html file that makes this, located on the Servoy webserver. Is this the only way or there are another solutions?
The second part of your question is not clear to me. You can call the Restfull webservice from anywhere, granted that the external server can reach the Servoy server.
Well, I’ll give an example.
In the demo solution, there is the file restfulws_testpage.html, located on servoy webserver: application_server\server\webapps\ROOT\examples. If I run this file from this server(http://localhost:8080/examples/restfulws_testpage.html) the HTTP PUT request is well done. If I copy this file on an Apache server and I run it from this server, the request is not done anymore. In Firebug, this request appears to be an OPTIONS request instead of PUT, so the ws_update() method is not called anymore.
Note: The GET request is made in both cases without any problem.
So the conclusion is that no matter from what server you make a PUT request to the restful service from Servoy, this request should be done correctly, even if the application that makes a request is located on a totally different server than Servoy is?
I changed the way to make the PUT request, i use now php_curl library and it works. The ws_update() method is called and executed.
In the ws_update() method, I change some data in the sybase database. I can see the changes in servoy application only if I restart the client, is it normal?
On the other hand, if I want to retrieve again from php the updated data, I can see only the old data, unless I restart the servoy server. Is it normal?
so you do update the database
and in different clients connected to that same application server instance you don’t see that data updating?
Did you disable somehow databroadcast?
Also when you start a fresh new smart client (or webclient in a new browser) you still see the old data?
The Servoy Version is 5.2.4.
After more tests I found the problem: in the begining I was testing in the Debug Client to see the changes made by the headless client when the webservice was calling the ws_update() method, not in a real Smart Client.
In the Smart Client I can see the changes just fine.
The ws_update() methods are not executed in the smart or webclient, but in (a pool of) headless clients.
This should work the same in developer and server, but you do need to make the solution the active solution in developer.
If you don’t see data changes, maybe you have autosave turned off?