Web Services

JAXB Marshalling and Unmarshalling

The snippet below unmarshalls a String containing xml of a OTAAirBookRS.


        JAXBContext jc = JAXBContext.newInstance(OTAAirBookRS.class);
        Unmarshaller unmarshaller = jc.createUnmarshaller();
        ByteArrayInputStream stream = new ByteArrayInputStream(response.getBytes());
        Object o = unmarshaller.unmarshal(stream);
        OTAAirBookRS rs = (OTAAirBookRS) o;
    

Published: Saturday, 20 January 2007