Java Web Services

Java Web Services

Published: Saturday, 20 January 2007

The Java API for XML Web Services (JAX-WS) is an API for creating and consuming web services, including SOAP.

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;

More Articles

Java Web Services