Example #1
0
  /**
   * Get formatted xml with request parametres for authorization
   *
   * @param login
   * @param password
   * @return String formatted xml
   */
  public String getAuthRequestXML(String login, String password) {
    BaseEntity entity = new BaseEntity();
    entity.put(XmlRpcRequestField.USERNAME, login);
    entity.put(XmlRpcRequestField.PASSWORD, password);
    entity.put(XmlRpcRequestField.VER, 1);

    XmlRpcSerializer serializer = new XmlRpcSerializer();
    String result = null;
    try {
      result = serializer.writeParamsToXmlRpc(entity, XmlRpcRequestField.METHOD_LOGIN);
    } catch (IllegalArgumentException e) {
      e.printStackTrace();
    } catch (IllegalStateException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    return result;
  }
Example #2
0
  public String getCommentsRequestXML(String login, String password) {
    BaseEntity entity = new BaseEntity();
    entity.put(XmlRpcRequestField.USERNAME, LOGIN);
    entity.put(XmlRpcRequestField.PASSWORD, PASSWORD);
    //		entity.put(XmlRpcRequestField.VER, 1);
    //		entity.put(XmlRpcRequestField.ITEMSHOW, 10);
    //		entity.put(XmlRpcRequestField.SKIP, 0);
    //		entity.put(XmlRpcRequestField.TRIM_WIDGETS, 50);
    //		entity.put(XmlRpcRequestField.PARSELJTS, Boolean.valueOf(true));

    XmlRpcSerializer serializer = new XmlRpcSerializer();
    String result = null;
    try {
      result = serializer.writeParamsToXmlRpc(entity, XmlRpcRequestField.METHOD_GETRECENTCOMMENTS);
    } catch (IllegalArgumentException e) {
      e.printStackTrace();
    } catch (IllegalStateException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    return result;
  }
Example #3
0
  public String getEventRequestXML(String login, String password, String journal, int itemId) {
    BaseEntity entity = new BaseEntity();
    entity.put(XmlRpcRequestField.USERNAME, LOGIN);
    entity.put(XmlRpcRequestField.PASSWORD, PASSWORD);
    entity.put(XmlRpcRequestField.VER, 1);
    entity.put(XmlRpcRequestField.TRUNCATE, 10000);
    entity.put(XmlRpcRequestField.PREFERSUBJECT, Boolean.valueOf(false));
    entity.put(XmlRpcRequestField.NOPROPS, Boolean.valueOf(false));
    entity.put(XmlRpcRequestField.NOTAGS, Boolean.valueOf(false));
    entity.put(XmlRpcRequestField.SELECTTYPE, String.valueOf("one"));
    entity.put(XmlRpcRequestField.ITEMID, itemId);
    entity.put(XmlRpcRequestField.LINEENDINGS, String.valueOf("space"));
    entity.put(XmlRpcRequestField.USEJOURNAL, JOURNAL);
    entity.put(XmlRpcRequestField.TRIM_WIDGETS, 10000);
    entity.put(XmlRpcRequestField.PARSELJTS, Boolean.valueOf(true));

    XmlRpcSerializer serializer = new XmlRpcSerializer();
    String result = null;
    try {
      result = serializer.writeParamsToXmlRpc(entity, XmlRpcRequestField.METHOD_GETEVENTS);
    } catch (IllegalArgumentException e) {
      e.printStackTrace();
    } catch (IllegalStateException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    return result;
  }