code: public Api fromXML(String xml) throws Exception {
      // retrieve the JAXB wrapper representation from the xml received
      Api api = Api.fromXML(xml);
      // check whether an error code was sent
      Error error = api.getError();
      // if there is an error - handle it
      if (error != null) {
        // prepare the error message
        String errMsg = "error code=" + error.getCode() + " info:'"
            + error.getInfo() + "'";
        this.handleError(errMsg);
      }
      return api;
    }
docs: return Api from the given xml
  @param xml - the xml go unmarshal
  @return
  @throws Exception