Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Web Server, Java Web Services - Hello World Tutorial [closed]

Does anyone know where I can find a good tutorial for setting up apache and a java web service (Hello World)?

I'm new to Apache and Java Web Services (do I need Tomcat?). I need a simple Java Web Service that can receive a simple http request from a client (eg. www.somedomain.com/service/001/notify). The idea is that a client will make an Http request and the Java Web Service will receive the request and run corresponding Java code on the host.

Sorry for the gaps in my knowledge, hence my need to have a tutorial.

In short I'd like to do this:

CLIENT:

new Request("www.somedomain.com/service/001/notify");

JAVA WEB SERVICE:

public void notify(int serviceID){
    System.out.println("Service " + serviceID + " says 'Hello!'");
}
like image 832
Jeremy Friesen Avatar asked Jan 13 '12 17:01

Jeremy Friesen


People also ask

How can I learn web services in java?

The java web service application can be accessed by other programming languages such as . Net and PHP. Java web service application perform communication through WSDL (Web Services Description Language). There are two ways to write java web service application code: SOAP and RESTful.

Is Apache Web server free?

Apache HTTP Server is a free and open-source web server that delivers web content through the internet. It is commonly referred to as Apache and after development, it quickly became the most popular HTTP client on the web.


1 Answers

This video is slightly outdated; but it is a good tutorial for an absolute beginner.

Also, Tomcat is what is called a servlet container. To see the difference between servlet containers and web services, here is a useful thread: Difference between servlet and web service

You should keep in mind that Tomcat is just one of the many options out there. If you're required to use it for school/work then go for it. But if you have the freedom to chose then I would recommend using google app engine java (tutorial here: http://code.google.com/appengine/docs/java/gettingstarted/ ). Under the hood they use Derby (I think most of Google's products run on Derby but I don't know that for sure).

The reason I'm recommending because out of my experience with setting up servlets/etc app engine so far has been the easiest. It also has a free hosting quota which you should be able to stay under since this is obviously going to be a trivial/learning experience. In terms of which servlet containers are better than others I don't think its going to matter at your level of exposure. Even though I've been messing around with them for a few years now it doesn't really matter to me either...

like image 200
Dave Avatar answered Oct 11 '22 10:10

Dave