Java Web Services
The Java API for XML Web Services (JAX-WS) is an API for creating and consuming web services, including SOAP.
JAXB Marshalling and Unmarshalling
Section titled “JAXB Marshalling and Unmarshalling”The snippet below unmarshalls a String containing xml document 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;