users@jersey.java.net

[Jersey] Is Jersey/REST good for the following?

From: John Smith <java.dev.mtl_at_gmail.com>
Date: Tue, 1 Nov 2011 11:08:37 -0400

I have an old lightweight message oriented web service pre "WS/SOAP" buz.
It pretty much receives value/pair or XML over HTTP(s) POST does something
with the XML (Insert to Database, Communicate to 3rd party etc...) and
returns a response value/pair or XML response to the client.

I'm currently looking to update this service to keep up with technology and
make it more standard.

The old service uses POST pretty much for anything but it works. You just
POST the required XML or value/pairs to it and it does what it needs and
replies back appropriately.

So REST seems more suited here then say a heavy SOAP service.

Now the issue I'm having is trying to standardize the old way with the new
way.

The old service always processes POST and always returns HTTP 200 OK and
the client parses the XML response to get a "status" code

So for instance if the service executed correctly it will return
<code>100</code><message>Approved</message>
If for example there is something wrong with the request then it will
return <code>900</code><message>Phone Number Submitted Invalid</message>

But looking at REST in general I need to start mapping my codes to HTTP
ones, but I have 100s of codes. I can have various success codes based on
the business logic executed etc... Or various failure codes. So I cannot
just simply map all success under HTTP 200 and all failures under HTTP 500
or what ever it is... Or is there a way to return HTTP 200 and a subcode or
something? Or for isnatnce 400 Bad Request but I would need to tell the
client exactly what the Bad Request is.