Hi All,
I know it’s possible to send a HTTP Request from within Servoy, but is it possible to send one from a webpage to Servoy where Servoy can manage the data wich is send within the request.
Thanks…
Hi All,
I know it’s possible to send a HTTP Request from within Servoy, but is it possible to send one from a webpage to Servoy where Servoy can manage the data wich is send within the request.
Thanks…
Hi Bert,
yes is possible, but you have to use php (or something like that) that on his way can communicate with your (online) database.
HJK:
yes is possible, but you have to use php (or something like that) that on his way can communicate with your (online) database.
Ok, I thought it would be something like that, and using PHP was planned also
Correct me if I’m wrong, but this would mean I have to trigger Servoy by sceduled methodes to acces and/or manage the data wich was put in the back-end database by the HTTP-request?!
Thanks… again.
Bert:
HJK:
yes is possible, but you have to use php (or something like that) that on his way can communicate with your (online) database.Correct me if I’m wrong, but this would mean I have to trigger Servoy by sceduled methodes to acces and/or manage the data wich was put in the back-end database by the HTTP-request?!
Anyone ???
without actually trying
I don’t think you need to program in order to obtain the data in the backend.
When the data has been committed to the backend, any query send to the backend from a client should update the foundset.
The only problem as I understand it, could be that the data inserts will not be broadcasted to clients that have loaded foundsets involving the backend table
hth
With a Servoy plugin it possible to register a webservice (servlet) which can accept http get/post requests, which can in turn store data in the database or trigger other server actions.
Hi Jan,
Are we talking webservices based on the SOAP protocol here? If so, could we get a simple example plugin maybe to demonstrate how this works? Also, at which URL are there webservices hosted?
Paul
We call it webservice because it provides web access to plugins, it is basically http support on which soap handling can be build.
Jan Blok:
We call it webservice because it provides web access to plugins, it is basically http support on which soap handling can be build.
Any plugin for Servoy in the near future regarding this functionality?
Would be very nice to get a simple sampleplugin to show how this stuff works. Then we can take it from there…
Paul
We currently have no sample availeble but its very easy, in the server plugin do:
public class MyServerPlugin implements IServerPlugin
{
public void initialize(IServerAccess app) throws PluginException
{
app.registerWebService("my_service",new MyServlet(app));
}
....
and make MyServlet class an ordinary Java servlet.
the MyServlet can be accessed as:
http://localhost:8080/servoy-service/my … e/test?x=1
Maybe dead easy for the standard Java guru…
The standard “MyServlet class an ordinary Java servlet”: What does this entail?
Could you maybe show how a simple HelloWorld example would be implemented?
Paul
pbakker:
Maybe dead easy for the standard Java guru…
Well, I’m not… thats why I’m using Servoy
http://www.google.com/search?sourceid=n … helloworld see first hit.
I did allready find the helloWorld Servlet, that’s not the point.
I asume I have to compile the helloworld Servlet and put it in the servoy/server/webapps dir???
and then the Serverside plugin: When I put your code into Eclipse, it won’t compile…
The “new MyServlet(app)” part in the registering of the webservice is giving an error. So, I asume I have to do more stuff to get it up and running, just have no clue what…
Paul
The servlet is loaded from the plugin, no install or something is need, just drop your plugin jar in the plugins dir. and you are done.
About the compile error; you don’t need to pass the ‘app’ object to the servlet, that was just an example
Well, I got it to compile, but now, when going to the servoy_service url, I get a tomcat Internal Server error…
It’s probably something stupid I’m doing wrong, but hey, that’s what you get when building an Application like servoy that is so simple to use that people like me start to use it and then offering the ability to make it more powerfull through plugins
Basically, now I’ve got a HelloServlet, containing the folloing code:
package test;
import javax.servlet.ServletException;
import javax.servlet.http.;
import java.io.;
public class HelloServlet extends HttpServlet
{
public void doGet (HttpServletRequest req,HttpServletResponse res)
throws ServletException, IOException
{
PrintWriter out = res.getWriter();
out.println(“Hello, world!”);
out.close();
}
}
And a serverside class with the following in it:
public class EmptyServerSideServer implements IServerPlugin {
public void initialize(IServerAccess app) throws PluginException
{
app.registerWebService(“test”,new HelloServlet());
}
public EmptyServerSideServer ()//must have default constructor
{
}
The whole thing compiles, but the webpages omly gives an error…
Paul
did you make the jar? place it in the plugins dir?
you have the url wrong, it is(in your case): http://localhost:8080/servoy-service/test/page?x=1 (no underscore but dash!)
Yes, created the Jar and placed it into the plugion directory.
I do think I use the correct URL, I didn’t use the literal servoy_service as I wrote (that was just an example )
I use URL: http://localhost:8080/servoy-service
If I remove the Jar from the plugin directory, and I restart Servoy and then go to this page, I see a webpage that says no webservices are registered. If I place the jar in the plugin directory, I get on the same page a Tomcat internal Server error.
Attached the Jar as I created it.
Paul
Mmm, I seem to be unable to upload the Jar…
I can send it by mail if you want…
Paul