Hi Folks - we saw a demo at Servoy Camp of using Servoy 5 to make RESTful web services, but it was pretty quick and I did’nt get too many notes and what I did get I’m struggling to make sense of (I seem to recall a discussion that the Camp video would make it all clear LOL but that was after the bar opened so I may have hallucinated it ).
Are there any step-by-step guides available to implement this plugin (which Plugin is it)?
it’s not a plugin like ‘the others’. This is what I got from the wiki pages:
Added a REST webservice plugin, which makes it possible to expose (form) methods as REST API handlers:
The REST API is accessible through the url: ``` http://domain:port/servoy-service/rest_ws/solutionName/formName
* The form needs to have the following methods:
o GET: ws_read()
o POST: ws_create()
o DELETE: ws_delete()
o PUT: ws_update()
* A sample solution is included in the Servoy distribution (servoy_sample_rest_ws.servoy), detailing how to retrieve data from the http request and to return a response.
So basically you need a solution with at least 1 form and 4 form-methods that will hold/call the code to be executed.
The sample solution can be found at “/application_server/solutions/examples”
FYI, I also have a plugin wich allows publishing Web Services from your application from Servoy version 3.x - current. Let me know if you are interested. It hasn’t been released yet, but will be soon. It also offers the ability to serialize JSDatasets to JSON to provider standard way of sharing data from your application.
goldcougar:
FYI, I also have a plugin wich allows publishing Web Services from your application from Servoy version 3.x - current. Let me know if you are interested. It hasn’t been released yet, but will be soon. It also offers the ability to serialize JSDatasets to JSON to provider standard way of sharing data from your application.
I’d be very interested to hear how that works Scott.
We currently don’t know what information we will need to share but we do know that there are three applications our Clients use that need to have interaction with our Solution (including SAP). Initially we want to make specific items of information available - and the demo of the REST services looks like it will do that, however doubtless we’ll need to share more sophisticated data as the Clients model of what he wants and his experience grows.
goldcougar:
FYI, I also have a plugin wich allows publishing Web Services from your application from Servoy version 3.x - current. Let me know if you are interested. It hasn’t been released yet, but will be soon. It also offers the ability to serialize JSDatasets to JSON to provider standard way of sharing data from your application.
Hi Scott,
Is it possible to serialize XML documents into JSON?
So that I can do:
var str = plugins.serialize.toJSON(myXMLDocument)
var obj = plugins.serialize.fromJSON(str)
return obj; // as result of a webservice
LOGIsoft:
Any clue as to what could be wrong? I’m using the original (unmodified) sample methods.
Ben,
RESTful webservices are not meant for browsers to be clients, you have to use a client that speaks http and understands the xml or json response.
We also shipped the test-page that Jan Blok used in the ServoyCamp demo which is an easy tool for testing/debugging your ws solution, the default url for this is:
RESTful webservices are not meant for browsers to be clients, you have to use a client that speaks http and understands the xml or json response.
We also shipped the test-page that Jan Blok used in the ServoyCamp demo which is an easy tool for testing/debugging your ws solution, the default url for this is:
Hi guys,
I’ve got a solution that runs gracefully in smartclient. Now I need to expose data to a webapp through RESTfull WS plugin, so I took the form and wrote the ws_read() method, but when i try to retrieve data, I get a 500 and this instead:
org.apache.wicket.WicketRuntimeException: There is no application attached to current thread http-8080-1
at org.apache.wicket.Application.get(Application.java:179)
at org.apache.wicket.Component.getApplication(Component.java:1323)
at org.apache.wicket.Component.<init>(Component.java:920)
at org.apache.wicket.MarkupContainer.<init>(MarkupContainer.java:113)
at org.apache.wicket.markup.html.WebMarkupContainer.<init>(WebMarkupContainer.java:49)
at org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup.<init>(WebMarkupContainerWithAssociatedMarkup.java:51)
at org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup.<init>(WebMarkupContainerWithAssociatedMarkup.java:43)
at org.apache.wicket.markup.html.panel.Panel.<init>(Panel.java:76)
at com.servoy.j2db.server.headlessclient.WebForm.<init>(WebForm.java:1)
at com.servoy.j2db.server.headlessclient.Zf.Ze(Zf.java:56)
at com.servoy.j2db.Zpb.<init>(Zpb.java:996)
at com.servoy.j2db.Zwb.Zg(Zwb.java:10)
at com.servoy.j2db.plugins.ClientPluginAccessProvider$MethodExecutor.run(ClientPluginAccessProvider.java:17)
at com.servoy.j2db.plugins.ClientPluginAccessProvider.executeMethod(ClientPluginAccessProvider.java:87)
at com.servoy.extensions.plugins.rest_ws.servlets.RestWSServlet.wsService(RestWSServlet.java:232)
at com.servoy.extensions.plugins.rest_ws.servlets.RestWSServlet.doGet(RestWSServlet.java:72)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at com.servoy.j2db.server.servlets.WebServicesServlet.service(WebServicesServlet.java:35)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Unknown Source)
Thanks to everyone for the answers, reading carefully the Wiki I found the problem, it was the Authentication, that is not supported.
Once removed I found a lot of problems with some “particular” listeners that I have in my solution, so I stop the tests because I can’t do anything without authentication.
I started a new Solution and everything goes well.
Hi guys, I’ve got another question: is possible to reach the WS via https anyway? I tried with “https//: etcetera” and the result was 404 for each call.