Skip to content

Instantly share code, notes, and snippets.

@akkida746
Created January 5, 2017 11:20
Show Gist options
  • Save akkida746/c83b4be51ee385e6f8ef2a2b5f82fbd3 to your computer and use it in GitHub Desktop.
Save akkida746/c83b4be51ee385e6f8ef2a2b5f82fbd3 to your computer and use it in GitHub Desktop.
Marshall Object to XML java
public static Order getOrder(String orderxml) throws GdiSomException
{
try {
JAXBContext jaxbContext;
jaxbContext = JAXBContext.newInstance(Order.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
StringReader reader = new StringReader(orderxml);
Order order= (Order) jaxbUnmarshaller.unmarshal(reader);
return order;
} catch (JAXBException e) {
throw new GdiSomException(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment