From: ses on
Just a general open ended question - I quite familiar with SOAP / WSDL
based web services and implementing them in Java (JAX-WS), but I've
not much experience of RESTful web services. As it is basically just a
design rather than a standard, are there any issues in terms of how
you implement them (for consumption by your own applications)?

Currently I'm considering just implementing them by simply writing a
simple HTTP server, and consuming them using a HTTP request which are
both very easy to do in java
From: Mike Schilling on
ses wrote:
> Just a general open ended question - I quite familiar with SOAP / WSDL
> based web services and implementing them in Java (JAX-WS), but I've
> not much experience of RESTful web services. As it is basically just a
> design rather than a standard, are there any issues in terms of how
> you implement them (for consumption by your own applications)?
>
> Currently I'm considering just implementing them by simply writing a
> simple HTTP server, and consuming them using a HTTP request which are
> both very easy to do in java

Look into Jersewy (Sun's implementation of JAX-RS.) It's very productive,
as it lets annotations do much of the work of defining the service and
operations, and how the different parts of the logical message are mapped
into the parts of the physical HTTP message.


From: ses on
Thanks for the information, this Jersey API certainly seems useful. It
still leaves me wondering if it is more appropriate in a lot of cases
to write one's own web service using HTTP. As RESTful web services
tend to be a lightweight thing it seems that perhaps it is better to
have a hands-on approach to implementing it.

Other than making it easier to code and to map the data in the HTTP
requests/responses, what else does the Jersey API offer in terms of
reliability, scalability etc. versus an ordinary HTTP server
implementation in Java?

On 29 Apr, 15:55, "Mike Schilling" <mscottschill...(a)hotmail.com>
wrote:
> ses wrote:
> > Just a general open ended question - I quite familiar with SOAP / WSDL
> > based web services and implementing them in Java (JAX-WS), but I've
> > not much experience of RESTful web services. As it is basically just a
> > design rather than a standard, are there any issues in terms of how
> > you implement them (for consumption by your own applications)?
>
> > Currently I'm considering just implementing them by simply writing a
> > simple HTTP server, and consuming them using a HTTP request which are
> > both very easy to do in java
>
> Look into Jersewy (Sun's implementation of JAX-RS.)  It's very productive,
> as it lets annotations do much of the work of defining the service and
> operations, and how the different parts of the logical message are mapped
> into the parts of the physical HTTP message.

From: Mike Schilling on
ses wrote:
>
> Other than making it easier to code and to map the data in the HTTP
> requests/responses, what else does the Jersey API offer in terms of
> reliability, scalability etc. versus an ordinary HTTP server
> implementation in Java?

AFAIK, nothing, any more than using JAXB gives you scalability and
reliability over coding the XML-parsing yourself.



From: Tom Anderson on
On Thu, 29 Apr 2010, ses wrote:

> Just a general open ended question - I quite familiar with SOAP / WSDL
> based web services and implementing them in Java (JAX-WS), but I've not
> much experience of RESTful web services. As it is basically just a
> design rather than a standard, are there any issues in terms of how you
> implement them (for consumption by your own applications)?
>
> Currently I'm considering just implementing them by simply writing a
> simple HTTP server, and consuming them using a HTTP request which are
> both very easy to do in java

I'd usually be thinking in terms of writing a servlet (or even a JSP)
rather than a server, and running it inside a servlet container.

If you don't want the overhead of a servlet container, you should look
into embedding Jetty:

http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty

If you want even more lightweight (but not very scalable, AFAIK), Sun's
super-secret embedded webserver is already in your JDK (as long as you
have a Sun 1.6 JDK):

http://java.sun.com/javase/6/docs/jre/api/net/httpserver/spec/index.html

Either way, writing an HTTP server from scratch is a mad idea. Perhaps
that's not what you meant.

On the client side, writing your own HTTP client is marginally less
unreasonable, but still pretty silly given the existence of the JDK;s
HttpURLConnection and Apache's HttpClient:

http://hc.apache.org/

tom

--
Formal logical proofs, and therefore programs - formal logical proofs
that particular computations are possible, expressed in a formal system
called a programming language - are utterly meaningless. To write a
computer program you have to come to terms with this, to accept that
whatever you might want the program to mean, the machine will blindly
follow its meaningless rules and come to some meaningless conclusion. --
Dehnadi and Bornat