public synchronized Response responseFromXML(final String xml, final Class<? extends Response> clazz)
throws JGBXException, JGBXFault {
try {
this.reader.parse(new InputSource(new StringReader(xml)));
if (this.handler.getMessageType() == MessageType.METHOD_RESPONSE) {
final Response r = clazz.newInstance();
r.setParams(this.handler.getParameters());
return r;
}
else if (this.handler.getMessageType() == MessageType.FAULT) {
@SuppressWarnings("unchecked")
final Map<String, Object> map = (Map<String, Object>) this.handler.getParameters().get(0);