cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose MarĂ­a Zaragoza <demablo...@gmail.com>
Subject REST/JSON webservice & messages with variable number of fields
Date Mon, 17 Feb 2014 14:59:35 GMT
Hello:

I'm using CXF 2.7.8

I need to develope a REST webservice. This webservice will receive by
POST , in a fixed URL/endpoint ( http://mywebservice/notify) , a lot
of messages in JSON format

For example

{ "status":"1", "client":"Amy" }
{ "status":"2", "agent":"00034", "city":"London" }
...
{ "status":"123", "color":"red" }

Note:
I cannot define another URL ( for example,
http://mywebservice/notify/{status}  )

Although the webservice can receive a lot of messages , it only must
perform some action with some of them, based on "status" field
For example, status 2, 5, 17. In other case, it only must log the
message received ( for example, "Status 123 received" )

I'm doing the webservice choosing Jettison as JSON provider, so I need
to have a class with JAXB annotations, so map the message to an object

If, in the future, a new message with a new status is sent ( {
"status":"124", "size":"20px" } ) , I don't want to have to compile my
JAXB classes again to map this new message

I would like:

- the non-relevant messages ( others than status is 2, 5, 17 ) map to
a fixed format , for example, { "status":"xxxx" }
So, if I receive  { "status":"124", "size":"20px" } ,  map it to  {
"status":"124" }

How I can do this ?

or

- any ideas ?

Thanks and regards

Mime
View raw message