Esempio n. 1
0
int main(int ac, char* av[])
{
  GError* err = NULL;
  char* uri = ac == 2 ? av[1] : "https://localhost:4444/RPC2";

  xr_debug_enabled = XR_DEBUG_CALL;

  xr_client_conn* conn = xr_client_new(&err);
  if (_check_err(&err))
    goto err;

  xr_client_open(conn, uri, &err);
  if (_check_err(&err))
    goto err;

  // start job

  gint job_id = TTest2_startQuery(conn, "http://localhost/slow.php", &err);
  if (_check_err(&err))
    goto err;

  // poll job result

  while (TRUE)
  {
    TQueryResult* result =  TTest2_completeQuery(conn, job_id, &err);
    if (err && err->code != T_XMLRPC_ERROR_TEST2_AGAIN)
    {
      _check_err(&err);
      goto err;
    }

    if (result)
    {
      g_print("Job done, result:\n%s\n", result->response);
      TQueryResult_free(result);
      break;
    }
    else
      g_usleep(1000 * 1000);

    g_clear_error(&err);
  }

  xr_client_free(conn);
  xr_fini();
  return 0;

err:
  xr_client_free(conn);
  xr_fini();
  return 1;
}
Esempio n. 2
0
int main(int ac, char* av[])
{
  GError* err = NULL;
  xr_servlet_def* servlets[3] = {
    __TTest1Servlet_def(),
    __TTest2Servlet_def(),
    NULL
  };
  
  g_set_print_handler(dbg);
  g_set_printerr_handler(dbg);

  //xr_debug_enabled = XR_DEBUG_CALL;

  xr_server_simple("server.pem", 100, "*:4444", servlets, &err);
  if (err)
    g_print("error: %s\n", err->message);

  xr_fini();

  return !!err;
}