Exemplo n.º 1
0
  public static void main(String[] args) {
    Log.init();
    Log.logger.info("Test WebService Start:");
    try {
      String endpoint = "http://localhost:9080/imws/services/ImpactManager";
      // String result="no result!";
      String namespace = "http://imapi.bmc.com/2010/01";

    } catch (Exception e) {
      Log.logger.error(e.getMessage());
    }
  }
Exemplo n.º 2
0
  public static void main(String[] args) {
    Log.init();
    Log.logger.info("事件查询开始");
    String url = null;
    String tokenurl = null;
    String username = null;
    String password = null;
    String jsonpath = null;
    Properties prop = new Properties();
    try {
      InputStream propin = new BufferedInputStream(new FileInputStream("searchEvent.properties"));
      prop.load(propin);
      url = prop.getProperty("SearchUrl");
      tokenurl = prop.getProperty("TokenUrl");
      username = prop.getProperty("username");
      password = prop.getProperty("password");
      jsonpath = prop.getProperty("json-path");
    } catch (Exception e) {
      Log.logger.error(e.getMessage());
    }

    AuthToken token = new AuthToken(username, password, tokenurl);
    String codeToken = token.getToken();
    StringBuffer jsonfile = new StringBuffer();
    File config = new File(jsonpath);
    InputStream in = null;
    try {
      in = new FileInputStream(config);
      int tempbyte;
      while ((tempbyte = in.read()) != -1) {
        jsonfile.append((char) tempbyte);
      }
      // System.out.print(testfile.toString());
      in.close();
    } catch (Exception e) {
      Log.logger.error(e.getMessage());
    }
    EventSearch event = new EventSearch(jsonfile.toString(), url, codeToken);
    event.POST();
  }