Skip to content

Instantly share code, notes, and snippets.

@presci
Created May 9, 2022 18:50
Show Gist options
  • Save presci/a29a8c89ed134dc07918690635923a0c to your computer and use it in GitHub Desktop.
Save presci/a29a8c89ed134dc07918690635923a0c to your computer and use it in GitHub Desktop.
jaxb converter
public static final AcctProductMapGetResT util(String str) {
try {
JAXBContext jaxbContext = JAXBContext.newInstance(AcctProductMapGetResponseT.class,
AcctProductMapGetResT.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
JAXBElement<AcctProductMapGetResponseT> jresp = unmarshaller.unmarshal(
new StreamSource(new ByteArrayInputStream(str.getBytes())), AcctProductMapGetResponseT.class);
AcctProductMapGetResponseT resp = jresp.getValue();
Assert.assertNotNull(resp);
return resp.getResponse();
} catch (Exception e) {
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment