RESTful web services are based on the way how
our web works. Our very own world wide web (www) – the largest distributed
application – is based on an architectural style called REST - Representational State Transfer. REST is neither a standard nor a protocol.It is just as architectural style like say for example client - server architectural style like say for example client-server architecture(client-server is neither a standard nor a protocol). Web services following this architectural style are said to RESTful Web services.
RESTful
web services are based on HTTP protocol and its methods PUT, GET, POST, and
DELETE. These web services are better integrated with HTTP than SOAP-based
services are, and as such do not require XML SOAP messages or WSDL service
definitions.
Java provides
support for Restful web services through Java API for RESTful Web Services
JAX-RS. The complete specification is available as JSR 311. JAX-RS is an
annotation-based API for implementing RESTful web services, based on HTTP, in
Java. Essentially, classes and methods are annotated with information that
enables a runtime to expose them as resources – an approach that is very
different from the one exposed by the servlet programming model. A runtime that
implements JAX-RS mediates between the HTTP protocol and the Java classes,
taking into account URIs, requested and accepted content types, and HTTP
methods
Project Description
In this example, we create a simple Java HelloGreetings class with operations ‘sayGreetings’.
We expose these as
restful web services which accepts HTTP GET Requests and sends the response as
XML or Plain Text.
The restful web
service is made available at http://localhost:8080/HelloWs/hello/sayGreetings
We send the
parameters in the URI itself. For example, to sayGreetings chandra URI is, http://localhost:8080/HelloWs/hello/sayGreetings
/chandra
We then create a web service client which
sends a HTTP GET Request to the mentioned URI and the response (result of the
invoked web service) is displayed.
EnvironmentUsed
EnvironmentUsed
Ø Java SE 6
Ø MyEclipse IDE
Creating
and Publishing Web Service
Here I am not
giving any steps why because if you may do some mistakes that’s why I am showing
video. its taking time to uploading this please be back some more time.If your not able to see video here please click here http://youtu.be/-z7yQeRSggc51%
Web Service Introduction
Post a Comment
Post a Comment