IgorShare Thoughts and Ideas

Consulting and Training

Archive for the ‘XML’ Category

XML/JSON symmetric REST web services providers for Jersey

Posted by Igor Moochnick on 07/27/2009

Many times I’ve been asked to provide a set of Web Services interfaces where both JSON and XML clients can communicate with the server. Primarily it’s done for a set of reasons:

  1. XML is very convenient to use for inter-service communication.
  2. JSON is great for AJAX (web) clients. It’s perfect for GWT too.

In the recent project we’ve been using XStream for all serialization aspects and, since it can serialize both to XML and JSON, it was plugged into Jersey as a provider too. Following you can see XML and JSON providers implemented using XStream library.

XML Provider (annotated to be a default provider, it’ll be used if no Content-Type or Accept headers provided):

Read the rest of this entry »

Posted in GWT, Java, Jersey, JSON, REST, Tutorials, XML, XStream | 2 Comments »

Building GWT web clients [Part 2] – How to expose REST-full JAX-RS service with Jersey on Tomcat server?

Posted by Igor Moochnick on 05/20/2009

In the previous article (Part 1) we’ve seen how to create a web-based REST-full client (and an appropriate server) by using GWT. GWT is not providing any “standard” REST (if you can use this word in REST context at all) interface, but, merely, exposes the server-side logic via a proprietary GWT RPC interface.

Today, the most common REST standard is the JAX-RS specification. By implementing your code along the JAX-RS guidelines you can be rest assured that you can easily switch one REST-RX library with another.

As of today there are a couple of JAX-RS libraries used by the Java community:

  1. Jersey
  2. Restlet
  3. Portlet
  4. etc…

On the other hand, being a big fan of Spring, I was hoping that Spring will provide the JAX-RS support in it’s Spring v3 release, but, looking at the M3 drop, I have realized that it’s nowhere near that promise (check my discussion on the StackOverflow).

For this post I’m going to use Jersey JAX-RS implementation. Let’s start with creating

Read the rest of this entry »

Posted in Java, JAX-RS, JAXB, Jersey, JSON, REST, Tomcat, XML | 6 Comments »

 
%d bloggers like this: