Examples of XmlAccessor


Examples of org.mmisw.ont.client.util.XmlAccessor

    response = response.replaceAll("\\s+", " ");
    log.info("----response=" +response);
   
 
    XmlAccessor xa = new XmlAccessor(response);
   
    if ( xa.containsTag("error") ) {
      throw new Exception("Could not create/update account");
    }
   
    if ( xa.containsTag("errorCode") ) {
      if ( response.contains("Duplicate") ) {
        throw new Exception("Please try a different username");
      }
      else {
        throw new Exception("Could not create/update account. Please try again later.");
      }
    }
   
    // Assign appropriate values to loginResult object
    String sessionId = xa.getString("success/sessionId");
    String id = xa.getString("success/data/user/id");
    String username = xa.getString("success/data/user/username");
    String role = xa.getString("success/data/user/roles/string");
//    String email = xa.getString("success/data/user/email");
//    String firstname = xa.getString("success/data/user/firstname");
//    String lastname = xa.getString("success/data/user/lastname");
//    String dateCreate = xa.getString("success/data/user/accessDate");

    // During account update, the roles are not reported (<roles/>); so, do not
    // check if role is emty.
    if ( sessionId == null || sessionId.trim().length() == 0
    ||   id == null || id.trim().length() == 0
    ||   username == null || username.trim().length() == 0
//    ||   role == null || role.trim().length() == 0
    ) {
      String error;
      if ( ! xa.containsTag("success") ) {
        // unexpected response.
        error = "Unexpected: server did not respond with a success nor an error message. Please try again later.";
      }
      else {
        error = "Could not parse response from registry server. Please try again later. response=" +response;
View Full Code Here

Examples of org.mmisw.ont.client.util.XmlAccessor

    response = response.replaceAll("\\s+", " ");
    log.info("----response=" +response);
   
   
    XmlAccessor xa = new XmlAccessor(response);
   
    if ( xa.containsTag("error") ) {
      throw new Exception("Invalid credentials");
    }
   
    // Assign appropriate values to loginResult object
    String sessionId = xa.getString("success/sessionId");
    String id = xa.getString("success/data/user/id");
    String username = xa.getString("success/data/user/username");
    String role = xa.getString("success/data/user/roles/string");
   
   
    if ( sessionId == null || sessionId.trim().length() == 0
    ||   id == null || id.trim().length() == 0
    ||   username == null || username.trim().length() == 0
    ||   role == null || role.trim().length() == 0
    ) {
      if ( ! xa.containsTag("success") ) {
        // unexpected response.
        throw new Exception("Unexpected: server did not respond with a success nor an error message. Please try again later.");
      }
      else {
        throw new Exception("Could not parse response from registry server. Please try again later. response=" +response);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.