NetBeans Java EE RESTful Web Service Primer Tutorial

NetBeans Java EE RESTful Web Service Primer Tutorial

NetBeans Java EE RESTful Web Service Primer Tutorial

Web Services allow for communication using the World Wide Web between two devices, as Wikipedia explains below. Do you remember previous Java Eclipse Web Service Primer Tutorial as shown below that used Eclipse IDE which works on Mac OS X and Windows? Well, today, we again use Java (Java EE), but this time we use the NetBeans IDE (rather than Eclipse) and create a “Hello World” simple web service using RESTful Web Service (as an alternative to SOAP and WSDL Web Service design, and we use a GlassFish local web server) techniques.

A web service is a method of communication between two electronic devices over the World Wide Web. A web service is a software function provided at a network address over the web or the cloud, it is a service that is “always on” as in the concept of utility computing.

The W3C defines a “Web service” as:

[…] a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.[1]

The W3C also states:

We can identify two major classes of Web services:

REST-compliant Web services, in which the primary purpose of the service is to manipulate XML representations of Web resources using a uniform set of “stateless” operations; and
arbitrary Web services, in which the service may expose an arbitrary set of operations.[2]

In this tutorial I wanted to show you the basics and followed the NetBeans sample RESTful project, just adding a recognizable additional string here and there to see where we are at when we run things (the suck it and see approach to learning about something).

Java EE stands for Java Enterprise Edition and you may want to read about Java EE Applications here and the idea of Enterprise JavaBean modules (EJB) here.

The two code files that got changed in that small way were:

Two more Java code files involved were:

Hope you see some usefulness in these, albeit simple, ideas today. Moving into the mobile (and of course, web) application world you can put web services to good service … it’s a web service behind how our mobile app Nimh plays music in the background … so that it is acting in a way that a thread could be working as a way to do two things at once.


Previous relevant Java Eclipse Web Service Primer Tutorial is shown below.

Java Eclipse Web Service Primer Tutorial

Java Eclipse Web Service Primer Tutorial

Web Services allow for communication using the World Wide Web between two devices, as Wikipedia explains below. This tutorial is using Eclipse IDE which works on Mac OS X and Windows, but if you are interested, look at ASP.Net Web Service Primer Tutorial for a Windows only idea.

A web service is a method of communication between two electronic devices over the World Wide Web. A web service is a software function provided at a network address over the web or the cloud, it is a service that is “always on” as in the concept of utility computing.

The W3C defines a “Web service” as:

[…] a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.[1]

The W3C also states:

We can identify two major classes of Web services:

REST-compliant Web services, in which the primary purpose of the service is to manipulate XML representations of Web resources using a uniform set of “stateless” operations; and
arbitrary Web services, in which the service may expose an arbitrary set of operations.[2]

In this tutorial I wanted to show you the basics and closely followed the Eclipse IDE Java advice of this PDF document by T320 E-business technologies, for whose expertise I am very grateful (thank you, thank you, thank you, thank you).

Eclipse IDE is a great IDE for developing Android Apps via Java as we discussed in Android Application (on Windows) Primer Tutorial, and this time around we are going to use the Mac OS X Eclipse (because we don’t want to hide our eclipse behind a bushel!?). Will show you some information from Wikipedia about Eclipse below.

In computer programming, Eclipse is a multi-language Integrated development environment (IDE) comprising a base workspace and an extensible plug-in system for customizing the environment. It is written mostly in Java. It can be used to develop applications in Java and, by means of various plug-ins, other programming languages including Ada, C, C++, COBOL, Fortran, Haskell, JavaScript, Perl, PHP, Python, R, Ruby (including Ruby on Rails framework), Scala, Clojure, Groovy, Scheme, and Erlang. It can also be used to develop packages for the software Mathematica. Development environments include the Eclipse Java development tools (JDT) for Java and Scala, Eclipse CDT for C/C++ and Eclipse PDT for PHP, among others.

The initial codebase originated from IBM VisualAge.[2] The Eclipse software development kit (SDK), which includes the Java development tools, is meant for Java developers. Users can extend its abilities by installing plug-ins written for the Eclipse Platform, such as development toolkits for other programming languages, and can write and contribute their own plug-in modules.

Released under the terms of the Eclipse Public License, Eclipse SDK is free and open source software (although it is incompatible with the GNU General Public License[3]). It was one of the first IDEs to run under GNU Classpath and it runs without problems under IcedTea.
Contents

This tutorial is a primer tutorial like the “Hello World” tutorial of Web Services accessing a local Apache Tomcat web server on a Mac OS X laptop, but it can easily be used as a starting point for your further investigation, as this is a large LARGE subject area.

Below are some good background reading for the concepts of this tutorial all via Wikipedia:

Maybe you’ll want to read about RESTful Web API as well.

Download and rename to Hello.wsdl as you see fit. This file is 90%+ used as the basis for PHP Web Service Primer Tutorial.

Some personal experience with Web Services and SAP B1 Web Services (ASP.Net) is show here.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, NetBeans, Software, Tutorials and tagged , , , , , , , , , , , , , . Bookmark the permalink.

4 Responses to NetBeans Java EE RESTful Web Service Primer Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *