I am going on playing with the restful_jaxrs sample demo

In the Client.java there are these lines

...
URL url = new URL("http://localhost:9000/customerservice/customers/123";);
        InputStream in = url.openStream();
        System.out.println(getStringFromInputStream(in));
....


What if I did not want to display the XML content (ie the XML
representation of customer whose Id is 123)
But rather I would like to get the actual instance of Customer with id is 123

Is there some Unmarshalling method to do that , something like

...
URL url = new URL("http://localhost:9000/customerservice/customers/123";);
        InputStream in = url.openStream();

// Hypothetic code
Customer customer = (Customer) getObjectFromInputStream(in);
...

How would I implement this

Object getObjectFromInputStream(InputStream in)

method ?

I guess I would have to get a JaxbContext before I can get an Unmarshaller ?


Thanks for your help

Eric




-- 
Eric Le Goff

Reply via email to