Hi Simon On Wed, Apr 6, 2011 at 10:59 PM, Simon Chen <[email protected]> wrote:
> Hi all, > > I am trying to build a RESTful web service... In short, I am having > trouble posting Java objects with member references from client side > to server side. > > I have mostly followed the example under > "apache-cxf-2.3.3/samples/jax_rs/basic". I have two major problems > now... > > 1) Handle objects with references. For example, a customer may have a > list of orders, and an order may be linked back to a customer. So, how > can I (or indeed what is the best way to) post an "Order" object with > a link to a "Customer" object to "/customerservice/orders"? > > 2) The example uses annotations like "XmlRootElement" to enable sort > of automated conversioning from java objects to XML/json data. But > this conversion seems to be broken when I add references into a class > definition. For example, when I post an "Order" object to > "/customerservice/orders", the server reports "No message body reader > has been found for request class Order", (even though the customer ref > is set to null). > > Is that Order class also annotated ? Can you post some sample structures showing what exactly you'd like to do ? Thanks, Sergey > Thanks. > -Simon >
