HTTP Request

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Postby Jan Blok » Wed Aug 11, 2004 5:41 pm

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 :?
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby pbakker » Wed Aug 11, 2004 7:30 pm

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 :lol:

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
{
}

+ all the usual functions you have in a Server side plugin.

The whole thing compiles, but the webpages omly gives an error....

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby Jan Blok » Thu Aug 12, 2004 10:20 am

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!)
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby pbakker » Thu Aug 12, 2004 10:56 am

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 :lol: )

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
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby pbakker » Thu Aug 12, 2004 11:02 am

Mmm, I seem to be unable to upload the Jar....

I can send it by mail if you want...

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby pbakker » Thu Aug 12, 2004 2:41 pm

OK, I see what you mean... The entire URL that you gave me does show the result of the Hello world plugin :D

But the http://localhost:8080/servoy-service URL gives the Tomcat internal server error. I think here it should display a lits of registered webservices, doesn't it?

Should I add another function for that or something?

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby pbakker » Fri Aug 13, 2004 2:53 pm

No comments of why the servoy-service URL gives a TomCat error?

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby Jan Blok » Fri Aug 13, 2004 10:03 pm

http://localhost:8080/servoy-service/ gives no error on my server, what error does it produce?
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby ROCLASI » Sat Aug 14, 2004 10:37 am

Okay, I tried the URL on 2.0.4 with no special plugins.
This is what I get:

Apache Tomcat/4.0.1 - HTTP Status 405 - HTTP method GET is not supported by this URL

type Status report

message HTTP method GET is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).


Mac OS X 10.3.5
Servoy R2 2.0.4-build 277
Java 1.4.2-38
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby pbakker » Sat Aug 14, 2004 3:28 pm

Ok, I have the plugin in my plugin directory, as described before. In I go to URL http://localhost/servoy-service, I get the follwoing:

Apache Tomcat/4.0.1 - HTTP Status 500 - Internal Server Error

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

type Exception report

message Internal Server Error

description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.

exception

java.lang.NullPointerException
at com.servoy.j2db.server.servlets.WebServicesServlet.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Unknown Source)



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

Now, If I go to URL: http://localhost/servoy-service/test/ then I get the result from my plugin (hello world!).


As said before: My servlet class looks like this:
package test;

import javax.servlet.ServletException;
import javax.servlet.http.*;
import java.io.*;

public class HelloServlet extends HttpServlet
{
public void service(HttpServletRequest req,HttpServletResponse res)
throws ServletException, IOException
{
PrintWriter out = res.getWriter();
out.println("Hello, world!");
out.close();
}
}

And ofcourse I have the serverside class:

public class EmptyServerSideServer implements IServerPlugin {

public void initialize(IServerAccess app) throws PluginException
{
app.registerWebService("test",new HelloServlet() );
}

public EmptyServerSideServer ()//must have default constructor
{
}

If you want I can send you the JAR (I do not seem able to add attachements to my posts)

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby Jan Blok » Mon Aug 16, 2004 10:06 am

pbakker wrote:Ok, I have the plugin in my plugin directory, as described before. In I go to URL http://localhost/servoy-service, I get the follwoing:Apache Tomcat/4.0.1 - HTTP Status 500 - Internal Server Error

what page/result whould you expect here then?
pbakker wrote:Now, If I go to URL: http://localhost/servoy-service/test/ then I get the result from my plugin (hello world!).

yes now you are accessing your servlet...
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby pbakker » Mon Aug 16, 2004 10:17 am

Well, if I go to URL http://localhost/servoy-service if my plugin is not in the plugin directory, I get a message that there are no Servoy webservices registered.

so, thinking logically, if I would register a webservice, I would expect the http://localhost/servoy-service URL to tell me the name of the registered service :D

I certainly do not expect to get an internal tomcat Server error.

If it's not possible to list the registered services, I would think an empty page would look a lot better than an page with an error.

As I said before: I can email the plugin so you can see it for yourself.

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Previous

Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 31 guests